diegoles / closure-library

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

goog.net.XhrManager ignores the opt_headers parameter #562

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. Create a goog.net.XhrManager object with some default headers:
   var headers = new goog.structs.Map();
   headers.set('X-Custom-Header', 'This text never reaches the server');
   var xhrManager = new easygis.net.XhrManager(0, headers);
2. Send a request to the server
   xhrManager.send('req','server.php');

What is the expected output? What do you see instead?
The expected HTTP request message is (I removed any additional headers
that are not influenced by the sample code):
GET /server.php HTTP/1.1
X-Custom-Header: This text never reaches the server

However, the transmitted message is:
GET /server.php HTTP/1.1

Inspecting the source code shows the opt_headers
is stored within the XhrManager's goog.net.XhrIoPool.
Strangely, goog.net.XhrIoPool's createObject is never called,
hence the opt_headers is ignored completely.

Original issue reported on code.google.com by etimm...@gmail.com on 24 May 2013 at 11:55

GoogleCodeExporter commented 8 years ago
OK, I found out the XhrManager DOES work correctly, it sends the headers as 
expected.
However, when using
  var xhrManager = new easygis.net.XhrManager(0, headers, MIN_COUNT)
with MIN_COUNT>0, the request is send without the headers!

I haven't found the bug itself, but in my case the errors was caused by a typo 
in the documentation. The goog.structs.PriorityPool docs say:
  @param {number=} opt_minCount Min. number of objects (Default: 1).
This is not correct, the default is 0.

Original comment by etimm...@gmail.com on 14 Aug 2013 at 2:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The same typo holds for goog.net.XhrManager

Original comment by etimm...@gmail.com on 14 Aug 2013 at 3:16

GoogleCodeExporter commented 8 years ago
Duplicate of https://code.google.com/p/closure-library/issues/detail?id=191

Original comment by etimm...@gmail.com on 14 Aug 2013 at 7:58

GoogleCodeExporter commented 8 years ago
2 years late, but this was recently fixed. 
https://github.com/google/closure-library/commit/98aad107ae6fa20c0a2f06b0ab827fa
361017c6b

Original comment by joelt...@google.com on 6 Aug 2015 at 11:05