Error response body is null?
- Dominant language
- CoffeeScript
- Stars
- 352
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
So I can't explain this...
```
GET /api/heatmaps/{chm}/datasets/{ds}/data -> 500
before-hook-GET-api-heatmaps-{chm}-datasets-{ds}-data-500 (toobiglabel)
1) Validate response code and body
after-hook-GET-api-heatmaps-{chm}-datasets-{ds}-data-500 (toobiglabel)
************************************************
test.response: { status: '500',
schema:
{ '$schema': 'http://json-schema.org/draft-04/schema',
id: 'http://jsonschema.net',
type: 'object',
required: true,
properties: { code: [Object], message: [Object] } },
headers: null,
body: null }
test.response.body: null
2) "after all" hook
```
```
2 failing
1) GET /api/heatmaps/{chm}/datasets/{ds}/data -> 500 Validate response code and body:
Uncaught AssertionError: Got unexpected response code:
label(s) not found
Error: expected 400 to equal '500'
2) GET /api/heatmaps/{chm}/datasets/{ds}/data -> 500 "after all" hook:
TypeError: Cannot read property 'code' of null
at hooks/test_data_hooks.js:93:28
```
While I believe the underlying C code may be responsible for the 400 vs. 500 issue,
my issue lies with the second test's lack of a `test.response.body` after its death...
``` javascript
hooks.before('GET /api/heatmaps/{chm}/datasets/{ds}/data -> 500', function(test, done) {
test.request.params.chm = 'kda-gbm-affy-analysis-012-newnorm';
test.request.params.ds = 'tcga-topg';
test.request.query['labels'] = Array(4096).join('x'); // :TBD: Why don't larger values this crash it?
test.request.headers['Accept'] = 'text/tab-separated-values,*/*;q=0';
console.log('before-hook-GET-api-heatmaps-{chm}-datasets-{ds}-data-500 (toobiglabel)');
return done();
});
hooks.after('GET /api/heatmaps/{chm}/datasets/{ds}/data -> 500', function(test, done) {
console.log('after-hook-GET-api-heatmaps-{chm}-datasets-{ds}-data-500 (toobiglabel)');
// :TBD: Think vendor code is incorrect here...
console.log('************************************************');
console.log("test.response:", test.response);
console.log("test.response.body:", test.response.body);
assert(test.response.body.code === 'Internal');
test.response.status = parseInt(test.response.status, 10);
assert(test.response.status === 500);
return done();
});
```
Why doesn't this get the same response body as I get from command line?
``` bash
$ curl -sS 'http://127.0.0.1:8080/api/heatmaps/kda-gbm-affy-analysis-012-newnorm/datasets/tcga-topg/data?labels=nosuchlabel'
{"code":"BadRequestError","message":"label(s) not found"}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the failing GET test and hooks/test_data_hooks.js at line 93, then reproduce the request and compare its response with the curl command shown in the issue. Determine why the automated request has a null body while curl returns an error object, and verify that the response-code and body assertions pass for the documented case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript, javascript
- Domain
- api, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100