-
Notifications
You must be signed in to change notification settings - Fork 934
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
POST Requests with raw post data #37
Comments
You're actually right, there's no way to upload raw data with POST/PUT/PATCH. This is an oversight, I'll have to get this down in 1.2, but it'll be pretty high priority. In the meantime, there is a way to set the content-type, but it requires you to go through the header. You have to add a While we're on the subject, what are your thoughts on providing a json library (I'm thinking Niels Lohmann's library)? This would let me do things like accept a |
For now, I'm going to limit the scope of this to just providing an API for setting a raw data type for a request. |
I personally think that adding json is out of the scope of a HTTP library. Honestly I'm a big fan of the HTTP package of Go https://golang.org/pkg/net/http/ (by the way that implements all of HTTP itself and I find it to be pretty clean too) and that's also pretty clear on staying in the HTTP realm. Also when cpr supports raw bodys either with it's own Body type or directly as string (this should probably be kept in sync with response.text / response.body) using json with it is absolutely trivial so the gain in my opinion isn't too big. |
Maybe I'm missing something but I couldn't find a way to do a post request with a custom content-type and raw body which is needed for many REST APIs that expect e.g. JSON in a POST body.
The text was updated successfully, but these errors were encountered: