bykof / cordova-plugin-webserver

A webserver plugin for cordova
Other
120 stars 51 forks source link

Header response with 2 "Content-Type" #2

Closed mickjol closed 6 years ago

mickjol commented 6 years ago

When the browser receive my response the header content 2 "Content-Type" The following code is what I send.

webserver.sendResponse(request.requestId, {
          status: status,
          body: body,
          headers: {'Content-Type': 'text/css'}
        });

And I receive

Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/plain
Content-Type:text/css
Date:Thu, 28 Sep 2017 22:45:10 GMT
Transfer-Encoding:chunked

If my "Content-Type" are "text/html; charset=UTF-8" or "application/javascript; charset=UTF-8" This doesn't not really matter, but when I send "text/css", the browser don't use the body as a stylesheet.

bykof commented 6 years ago

Yes because the both "Content-Type" keys interfere with each other. I will look at my code and write you again

bykof commented 6 years ago

@mickjol okay so you are using an Android right? Because the header will not override if its the ios package.

bykof commented 6 years ago

@mickjol i updated the repository. Update to version 1.0.1 and tell me if its working