diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

XhrIo.getResponseHeader inconsistent across browsers when header is not present #504

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
On Firefox, calling getResponseHeader for a non-existent header on an XhrIo 
object returns null.
On Chrome, it returns null.
On IE, it returns an empty string.

This is due to an underlying inconsistency of XMLHttpRequest.getResponseHeader.

The fake implementation (testing.net.XhrIo) returns undefined for that case.

None of this is mentioned in the docs for the method. Perhaps we should 
normalise on one return value, to reduce cross-browser bugs, or at least 
document the return value.

What steps will reproduce the problem?
1. Call XhrIo.send to some URL.
2. In the callback, output the value of 
event.target.getResponseHeader("non-existent")

What is the expected output? What do you see instead?
Either "", undefined or null, but the same thing on all browsers. Instead I see 
variation.

What version of the product are you using? On what operating system?
Firefox 16.0, Chrome 23.0 on Ubuntu Lucid
Internet Explorer 9.0.10 on Windows 7

Original issue reported on code.google.com by nim...@google.com on 10 Oct 2012 at 4:23