[SOLVED] HTTP 1.1: mimeType in response body

Oct 8, 2019
5
0
10
Hello,

I'm writing my own HTTP server in win32.
I also wrote an HTTP server in C# which is working OK. It is used as reference.

When Chrome works with the C# version, I got the following response:
"content": {
"size": 37277,
"mimeType": "application/javascript",
"text": "(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{2:function(e,t,n){e.exports=n(\"hN/g\")},\"hN/g\":function(e,t,n){\"use strict\";n.r(t),n(\"pDpN\")},pDpN:function(e,t)....}

-----------------------------------------------------------------------------------------------------------------------------

When Chrome works with the win32 version, I got the following response:
"content": {
"size": 37277,
"mimeType": "text/plain",
"text": "(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{2:function(e,t,n){e.exports=n(\"hN/g\")},\"hN/g\":function(e,t,n){\"use strict\";n.r(t),n(\"pDpN\")},pDpN:function(e,t)....}

I'm sending the reply body just after the reply headers.

In both versions, Chrome got the following header:
Content-Type: application/javascript

Can you please tell how should I set "mimeType" in the reply body ?

Thank you in advance,
Zvika
 
Oct 8, 2019
5
0
10
Hello,

I added the header:
X-Content-Type-Options: nosniff

to the win32 version and got:
"content": {
"size": 37277,
"mimeType": "application",
"text": ...

This did not solve the problem .
This header was not sent by the C# version. But as I said, this version works perfect.

Thank you,
Zvika
 
Oct 8, 2019
5
0
10
Hello,

Solved.
The cause to the problem:
In the win32 version, the header was:
application / javascript

It should be:
application/javascript

Zvika
 
Solution