rahu28 / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

assets are served with content type "text/plain" #145

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
As of r634 all HTML, JavaScript, and CSS files seem to be served with the 
content type "text/plain" for test resources and with no content type at all 
for slave resources.  The content types for these resources should be 
"text/html", "text/javascript", and "text/css" respectively.

A patch to address this issue is attached.

Original issue reported on code.google.com by halle...@gmail.com on 7 Oct 2010 at 8:45

Attachments:

GoogleCodeExporter commented 8 years ago
Issue 183 has been merged into this issue.

Original comment by corbinrs...@gmail.com on 4 Jan 2011 at 9:31

GoogleCodeExporter commented 8 years ago

Original comment by corbinrs...@gmail.com on 14 Feb 2011 at 4:39

GoogleCodeExporter commented 8 years ago
Hi, sorry if this is a stupid comment but the status of this issue is "fixed", 
fixed on Feb 14 it would seem, however it is not fixed in 1.3.1 (build on Feb 
18).  

I can't see it fixed when I browse the code either.

Original comment by maly...@gmail.com on 4 Mar 2011 at 1:24

GoogleCodeExporter commented 8 years ago

Original comment by corbinrs...@gmail.com on 4 Mar 2011 at 2:47

GoogleCodeExporter commented 8 years ago
besides the types already mentioned (.html, .js, .css, .xml) another important 
one is .xsl as this is another client side "browser language".

Original comment by maly...@gmail.com on 4 Mar 2011 at 7:57

GoogleCodeExporter commented 8 years ago
So which ones are served with text/plain?

Original comment by corbinrs...@gmail.com on 4 Mar 2011 at 9:24

GoogleCodeExporter commented 8 years ago
I just checked this in chrome. The resources, both static and test are served 
with the correct mime-type. Please provide more information about the files 
being served, the browser you are using and any other pertinent data for 
reproduction.

Original comment by corbinrs...@gmail.com on 5 Mar 2011 at 12:25

GoogleCodeExporter commented 8 years ago
I am getting this issue in Chrome 10.  I haven't tested in other browsers but 
assume the same problem exists since it is the server setting the response 
header. I doubt the browser will make much difference except of course in IE 
the symptoms will probably be hidden since it generally ignores content type 
headers and does its own content type sniffing.

I have tested on Ubuntu 10.10 and Windows XP.

Here's how to replicate:

1. From your "hello world" example grab the following to set up a basic project:
  - src, src-test, jsTestDriver.conf
2. Download "JsTestDriver-1.3.1.jar" from the project home page.
3. Create a directory "resources" next to the "src" and "src-test" directories.
4. In resources dir create a file "note.xml" (I borrowed the XML file from 
W3Schools to save some typing: http://www.w3schools.com/Xml/note.xml).
5. Add this to the jsTestDriver.conf:

serve:
  - resources/*.*

6. Kick off the server with command: "java -jar JsTestDriver.jar --port 9876"
7. In chrome go to: http://localhost:4224/test/resources/note.xml

You will see the XML document loaded in Chrome BUT if you open the developer 
tools and load note.xml you will see on the network tab that "type" is 
"text/plain".

Also, if you right click note.xml in the developer tools and choose "Export to 
HAR" you will find this in the response headers section: 
{"name":"Content-Type","value":"text/plain"}

This issue causes all AJAX unit tests to fail in JsTestRunner since 
"responseXML" is null.

Original comment by maly...@gmail.com on 5 Mar 2011 at 8:26

GoogleCodeExporter commented 8 years ago
Ok strictly speaking the command on step 6 should read:
"java -jar JsstDriver-1.3.1.jar --port 4224"

Original comment by maly...@gmail.com on 5 Mar 2011 at 8:28

GoogleCodeExporter commented 8 years ago
And sorry, when I wrote "JsTestRunner" I meant "JsTestDriver", silly me.

Original comment by maly...@gmail.com on 5 Mar 2011 at 8:30

GoogleCodeExporter commented 8 years ago
Everything is served as text/plain except for *.js or *.css

Those are the only 2 types defined in the MIME_TYPE_MAP inside of 
StaticResourceHandler.java.

Adding more entries (e.g. for "xml") solved this problem for me.

See attachment to http://code.google.com/p/js-test-driver/issues/detail?id=183

Original comment by dmccart...@gmail.com on 5 Mar 2011 at 10:52

GoogleCodeExporter commented 8 years ago
Ah. Will add xml. Any others?

Original comment by corbinrs...@gmail.com on 21 Sep 2011 at 7:56

GoogleCodeExporter commented 8 years ago
The minimum we needed to get ours to work was:

("xml", "text/xml")
("html", "text/html")

Original comment by maly...@gmail.com on 21 Sep 2011 at 9:36

GoogleCodeExporter commented 8 years ago
If it's not too late, ("rdf", "application/rdf+xml")

Original comment by maly...@gmail.com on 27 Sep 2011 at 11:47

GoogleCodeExporter commented 8 years ago
r1096, sorry for the delay.

Original comment by corbinrs...@gmail.com on 2 Dec 2011 at 9:47