Project

Profile

Help

Maintenance: Planio will be observing a scheduled maintenance window this Sunday, November 10, 2024 from 20:00 UTC until 21:00 UTC to perform important network maintenance in our primary data center. Your Planio account will be unavailable for a few minutes during this maintenance window.

Bug #4174

closed

No response body from HTTP request when http.status >= 400

Added by Debbie Lockett over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
IXSL extensions
Sprint/Milestone:
-
Start date:
2019-03-20
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
1.0, Trunk
Fix Committed on JS Branch:
1.0, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

Issue raised by user on Saxon-JS forum at https://saxonica.plan.io/boards/5/topics/7423:

"When I use ixsl:schedule-action to do an http-request, I'm not getting a body in the response map for errors (though the bodies do show up just fine for 2xx responses). For example, POSTing a malformed document, I'm returned:

map{"headers":map{"connection":"close", "content-type":"application/xml;charset=UTF-8", "transfer-encoding":"Identity", "date":"Wed, 20 Mar 2019 00:16:19 GMT"}, "status":400, "message":"", "type":"load"}"' "

In the Saxon-JS code (BrowserPlatform makeHttpRequest) it appears that we only add response.body if !request["status-only"] && http.status < 400. I'm not sure where that restriction came from; I probably wrongly assumed that error responses never have bodies...

Actions #1

Updated by Debbie Lockett over 5 years ago

  • Description updated (diff)
Actions #2

Updated by Debbie Lockett almost 5 years ago

Tests added under tests/saxon-js/http: see httpMethodTests and httpStatusTest.

httpStatusTest allows the testing of different status codes for a HTTP response (set by supplying a code via a textarea input box) - to check the returned response header and body.

httpMethodTests contains various tests of GET and HEAD requests, including use of status-only with HEAD requests (as David added on original forum post, it doesn't really make sense that status-only is required for a HEAD request).

Actions #3

Updated by Debbie Lockett almost 5 years ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch 1.0, Trunk added

Changes committed in BrowserPlatform.js for 1.x and 2 branches.

Includes fixes for all issues raised in original forum post:

  1. Include response body from HTTP request when http.status >= 400
  2. Remove problematic unused code on line 373 var part2 = typeParts[1].trim();
  3. status-only should not be required for HEAD requests

Plus a couple of other issues encountered in testing (e.g. media-type should be ignored for HEAD and GET requests).

Actions #4

Updated by Debbie Lockett over 4 years ago

  • Status changed from Resolved to Closed
  • Fixed in JS Release set to Saxon-JS 2.0
Actions #5

Updated by Debbie Lockett over 4 years ago

  • Category set to IXSL extensions

Please register to edit this issue

Also available in: Atom PDF Tracking page