We are running libmicrohttpd in an API which uses JSON in both request and 
response bodies almost exclusively with no issue. We do also use form data. If 
the client sends a body with "application/json" as the "Content-Type" header, 
we will see whatever they sent via MHD_get_connection_values.

I have just verified this, using libmicrohttp v0.9.62, by sending a request 
with a "Content-Type" header of "application/json", then using 
MHD_get_connection_values with MHD_HEADER_KIND, and it gives me a key of 
"Content-Type" exactly once with a value of "application/json".

Perhaps providing example code related to your header parsing would help?

-
Justin Graves
On Feb 22, 2019, 3:02 AM -0600, Hedin, Richard (InfoSys) 
<[email protected]>, wrote:
> Gentlepeople:
>
> I am using libmicrohttpd to make, naturally, a web server.  The client wants 
> to send me a post request with a content type of “application/json”.
>
> Libmicrohttpd doesn’t seem to support application/json.  Only 
> "application/x-www-form-urlencoded" and "multipart/form-data".  I tried using 
> MHD_set_connection_value as the source code suggested, but it doesn’t work.  
> I suspect it doesn’t replace the existing Content-Type key, but adds a header 
> to the end.
>
> Does libmicrohttpd just not work for this case?  I don’t feel I can tell my 
> client not to send me application/json.  It’s such an obvious and commonly 
> accepted format.
>
> Ideas?
>
>                          Regards, Rick
>
> Get the AAA Mobile app!
> AAA Disclaimer Communication
> This communication (including all attachments) is intended solely for the use 
> of the person(s) to whom it is addressed and should be treated as a 
> confidential AAA communication. If you are not the intended recipient, any 
> use, distribution, printing, or copying of this email is strictly prohibited. 
> If you received this email in error, please immediately delete it from your 
> system and notify the originator. Your cooperation is appreciated.

Reply via email to