Skip to content

Commit 161d64d

Browse files
committed
HTTP package: fix URL building
If a URL has no query string, the HTTP package added the string 'undefined' to the end of the URL. This fix reduces the failing assertions in the existing tests for the HTTP package from 8 to 1 (using InDesign CS6 as the environment). This fix is similar to pull request debrouwere#23.
1 parent b315665 commit 161d64d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core-packages/http/lib/index.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,12 @@ function HTTPRequest (method, url, timeout) {
347347
// request line
348348
var head = [];
349349
var url = this.url();
350-
var path = url.pathname + url.search;
350+
var path;
351+
if (url.search) {
352+
path = url.pathname + url.search;
353+
} else {
354+
path = url.pathname;
355+
}
351356
var request_line = "{} {} HTTP/1.1".format(this.method(), path || "/");
352357
head.push(request_line);
353358
// headers to string (kv) form
@@ -575,4 +580,4 @@ function HTTPResponse (method, encoding, request) {
575580
* However, before we could consider this optimization, we'd need to optimize the ByteString class,
576581
* and in particular make it possible and fast to concatenate / add in string data to an existing
577582
* byte class. Then we could process the data parts we receive on the fly rather than post-hoc.
578-
*/
583+
*/

0 commit comments

Comments
 (0)