Questions tagged [content-type]

The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.

The Content-Type entity-header field indicates the media type (or MIME type) of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET.

Content-Type   = "Content-Type" ":" media-type

An example of the field for HTML documents is:

Content-Type: text/html; charset=ISO-8859-4

For a PNG file, it would be:

Content-Type: image/png


HTTP Specification : Section 14 : Header Field Definitions

Wikipedia articles:

  1. MIME
  2. Internet media type
2280 questions
37 answers

What is the correct JSON content type?

I've been messing around with JSON for some time, just pushing it out as text and it hasn't hurt anybody (that I know of), but I'd like to start doing things properly. I have seen so many purported "standards" for the JSON content…
  • 225,853
  • 62
  • 212
  • 293
3 answers

Proper MIME media type for PDF files

When working with PDFs, I've run across the MIME types application/pdf and application/x-pdf among others. Is there a difference between these two types, and if so what is it? Is one preferred over the other? I'm working on a web app which must…
  • 64,008
  • 16
  • 112
  • 180
20 answers

How do you set the Content-Type header for an HttpClient request?

I'm trying to set the Content-Type header of an HttpClient object as required by an API I am calling. I tried setting the Content-Type like below: using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new…
  • 13,884
  • 5
  • 32
  • 44
10 answers

HTML Input="file" Accept Attribute File Type (CSV)

I have a file upload object on my page: with the following excel files on my desktop: file1.xlsx file1.xls file.csv I want the file upload to ONLY show .xlsx, .xls, & .csv files. Using the accept attribute,…
  • 35,163
  • 12
  • 47
  • 79
5 answers

What MIME type should I use for CSV?

I've seen application/csv used and also text/csv. Is there a difference? Does it matter which as long as the request matches something that's available? Are they interchangeable?
Steve Dunn
  • 19,546
  • 11
  • 60
  • 87
6 answers

Setting mime type for excel document

MS Excel has the following observed MIME types: application/…
  • 5,122
  • 5
  • 23
  • 24
4 answers

What are all the possible values for HTTP "Content-Type" header?

I have to validate the Content-Type header value before passing it to an HTTP request. Is there a specific list for all the possible values of Content-Type? Otherwise, is there a way to validate the content type before using it in an HTTP request?
  • 4,661
  • 6
  • 30
  • 54
17 answers

Jquery - How to make $.post() use contentType=application/json?

I've noticed that when using $.post() in jquery that the default contentType is application/x-www-form-urlencoded - when my mvc code needs to have contentType=application/json (See this question for why I must use application/json: ASPNET…
  • 20,541
  • 31
  • 127
  • 206
4 answers

Difference between application/x-javascript and text/javascript content types

What is the difference between these headers? Content-Type: application/javascript Content-Type: application/x-javascript Content-Type: text/javascript Which one is best and why? Please do not say they are identical - if they were identical there…
Obmerk Kronen
  • 15,115
  • 16
  • 63
  • 104
3 answers

What are the differences between application/json and application/x-www-form-urlencoded?

What is the difference between request.ContentType = "application/json; charset=utf-8"; and request.ContentType = "application/x-www-form-urlencoded";
Prithvi Raj Nandiwal
  • 2,744
  • 3
  • 19
  • 33
6 answers

Do I need a content-type header for HTTP GET requests?

As far as I understood there are two places where to set the content type: The client sets a content type for the body he is sending to the server (e.g. for post) The server sets a content type for the response. Does this mean I don't have to or…
Martin Flucka
  • 2,825
  • 5
  • 26
  • 43
13 answers

Where's my JSON data in my incoming Django request?

I'm trying to process incoming JSON/Ajax requests with Django/Python. request.is_ajax() is True on the request, but I have no idea where the payload is with the JSON data. request.POST.dir contains this: ['__class__', '__cmp__', '__contains__',…
9 answers

Mail multipart/alternative vs multipart/mixed

When creating email messages you are supposed to set the Content-Type to multipart/alternative when sending HTML and TEXT or multipart/mixed when sending TEXT and attachments. So what do you do if you want to send HTML, Text, and attachments? Use…
  • 52,774
  • 75
  • 248
  • 359
3 answers

Content-Type header [application/x-www-form-urlencoded] is not supported on Elasticsearch

I used to have ElasticSearch 5.2, and just upgraded to 6.0. I am trying to create an index template following guide here, but got error Content-Type header [application/x-www-form-urlencoded] is not supported My query is curl -X PUT…
Barry Leishman
  • 1,693
  • 2
  • 6
  • 7
7 answers

Create request with POST, which response codes 200 or 201 and content

Suppose I write a REST service whose intent is to add a new data item to a system. I plan to POST to http://myhost/serviceX/someResources Suppose that works, what response code should I use? And what content might I return. I'm looking at the…
  • 53,570
  • 11
  • 71
  • 113
2 3
99 100