Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

curl -d '{}' /your/swagger/url/here causes a crash #504

Open
MikeSandfordArundo opened this issue May 10, 2017 · 3 comments
Open

curl -d '{}' /your/swagger/url/here causes a crash #504

MikeSandfordArundo opened this issue May 10, 2017 · 3 comments

Comments

@MikeSandfordArundo
Copy link

I discovered this error and a co-worker did the sleuthing to track down the exact problem. It turns out that curl will default to application/x-www-form-urlencoded when you don't specify a content type. And that can cause a process to crash due to an unhandled exception (at least for us) deep in the bowels of things completely outside of our code.

What happens is that the url encoded data gets choked on right here: https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-metadata.js#L206

He changed that "%s" to "%j" and no more problems.

@MikeSandfordArundo
Copy link
Author

I've made a PR for these changes: #505

@MikeSandfordArundo
Copy link
Author

While driving this morning I realized that this issue is a little vague. The URL needs to be one that accepts POSTs because otherwise the debug message is circumvented, no further processing (and failing) takes place. It may also need to be running in debug mode (haven't verified yet).

@whitlockjc
Copy link
Member

Thanks, I'll give it a peek.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants