-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add content-type header #101
Conversation
required by wharfkit/atomicassets#3 |
This change is causing CORS errors when using some nodes. This change means that the header is always set to The headers should be passed through the call method, not determined automatically. |
This api only supports json body, this is implied by
|
This was tested and proven, I don't know how you can deny this commit broke the library. It is not acceptable to require almost all RPC API providers to change their configs to support a change in this library. |
No, it's not proven at all, it's just our nodes(wax.greymass.com) used the wrong config. Stop blaming me for that.
Also here atomicassets' api middleware: https://expressjs.com/en/resources/middleware/body-parser.html#bodyparserjsonoptions
We already use 'Access-Control-Allow-Origin: *' in our nodeos configuration, it's just there are some misconfiguration for the prelight request, that it failed the 'OPTIONS' call. And i am not automatically setting the 'Content-Type' header, we have been treating the request body as json from the library's beggining. |
What should happen is nodeos fixes its defaults in a future release, and after that release hits a saturation point and nearly everyone is running it - then we update this library to do things the "right" way. Maybe Leap 6.0 is a good target to make this fix. If we do this right now according to the standards, we'll cause connectivity problems with nearly every app who upgrade to the newest version of this library. Many of them depend on 3rd party APIs, who's operators are completely unaware this is even a problem right now. This would cause a flurry of apps complaining to API providers to "update their APIs" in an uncoordinated manner. It sucks that we're stuck doing things against the standards... but in a decentralized ecosystem like this we can't control or even communicate with everyone running the software. |
Yeah, i agree this is not acceptable as a sudden change, cause it may break some services. I just saw the code already treat request body as json, didn't realize it could break things if we specify 'Content-Type' for it. express thinks if you don't specify 'Content-Type' you are wrong, nodeos (by default) thinks you specify it you are wrong. You need to start nodeos this way to remove cors issues: |
For reference: AntelopeIO/leap#2188 |
No description provided.