-
Notifications
You must be signed in to change notification settings - Fork 109
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
Can't set custom Content-Type #9
Comments
I see. Yes, Everest determines the content type from the body. |
Sure. While you do your thing, I'll look into your code. Maybe I can make a pull request. |
Hi, I've been evaluating this issue and have a few questions. To be frank, I've never used custom types so I tried them on Insomnia and noticed that it allows overriding for all types of request bodies except multipart/form-data. Do you happen to know why they're doing so? I have a solution almost ready. Feel free to contribute though. I'll be putting up a Contributions Guide soon so I suggest you wait for that before making a PR. |
I'll take your pull. I noticed you use the content type to drive a lot of internal logic like BodyTagController's switch around line 142 and other places. I'm not sure how I'd refactor that kind of code without moving a lot of parts. I was trying to see how to not use DashboardState.getContentType(), but rather the headers. I'm not familiar with Insomnia, but I use Postman. Basically, multipart/form is an official encoding spec. Everything else is just characters as far as HTTP is concerned. People just like to use json since it's less verbose than XML, and readable. Nothing stops anyone from dropping Java serialized messages into a post body and setting the correct Content-Type header. As part of REST, one should define their own schema/MimeTypes. That's part of the whole HATOEAS thing. Often people skip this and just use application/json. Unfortunately, that's not enough contextual info for a rest client. That's why I use the Mime Type. All of mine are serialized as JSON, but for correctness and debugging my services all define the resource with Mime Types. Hope this doesn't come across as preachy, just trying to share why people use this technique. |
Not preachy at all, that's really helpful. Thanks a lot! 👍 I've made changes to DataDispatchRequestManager, which handles POST, PUT and PATCH requests. Basically, it will still determine the content type from the UI (based on the tab you have selected), but it will now check for an override before making the request. I request you to try out this this test build and let me know if this works for you. If you have any issues, we'll sort them out else I'll push the changes to the core-optimization branch. I have a few more things in mind before I push out Alpha 1.1 so I suggest you build from core-optimization meanwhile. |
That worked great. |
I use custom mimetypes for all of my calls. When attempting to post, the header value I put in gets overridden by the body configuration. I've not been able to undo that override.
The text was updated successfully, but these errors were encountered: