Questions tagged [content-type]

The entity-header field Content-Type specifies the media type of the entity-body being transmitted to the recipient, or in the case of a HEAD request, it denotes the media type that would have been included if the request were a GET method instead.

Transmit a form containing a downloaded file through an HTTP request

I am facing an issue with sending an email form and an input file to my server. Despite no errors in the console, I can't seem to upload the file correctly as an attachment in the email. post(f: NgForm) { const email = f.value; const headers = new ...

Managing various types of content in a Node.js application

I am currently working on an API in Node.js that will be accessed by various applications. These applications may make calls with different content types, so I have implemented the body-parser to parse the request data. To ensure consistency and proper fu ...

The type parameter is overlooked by body-parser

When handling inbound requests with a Content-Type: application/vnd.surveymonkey.response.v1+json, I encountered some difficulties using the body-parser. According to the documentation, the body-parser's json factory method should only parse json and ...

Differences between x-www-form-urlencoded and JSON in HTTP POST requestsWhen

Struggling to make a decision, I am currently using php lib curl to send data as x-www-form-urlencoded with the following code: curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->arguments)); or curl_setopt($curl, CURLOPT_POSTFIELDS, $t ...

Is there a way to specify a custom Content-Type for a jax-rs client?

Running JAX-RS resources declared in the following way: public interface MyEntityServiceV2 { @PUT @Consumes({"application/myentity-v2+json"}) @Produces({"application/myentity-v2+json"}) @Path("/{uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA- ...

The WCF Service is experiencing issues when attempting to call a client for accessing REST with JSON, as the correct content type is

I've been struggling with a perplexing issue for the past few days - I'm trying to utilize a WCF service to call another RESTful service. However, as I trace through the process, it consistently fails to set the appropriate JSON content type on the messag ...

Is it safe to set content type as text/plain instead of application/json for JSON response?

I've been developing a PHP script to retrieve public JSON data, which will be accessed by JavaScript on the client side. However, I've encountered an issue with the server (LiteSpeed shared hosting) not having brotli/gzip compression enabled for ...

When using $.ajaxSetup, the content type is not configured for Get requests

Snippet 1 $.ajax({url:"1.aspx/HelloWorld",type:"GET",dataType:"json",contentType:"application/json"}); Snippet 2 $.ajaxSetup({ contentType: "application/json", dataType: "json" }); $.get( ...