mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-10 23:12:39 +00:00
Make sure server response body is parsed
This commit is contained in:
parent
97d778634d
commit
b47adaefa4
@ -33,7 +33,7 @@ exports.request = (method = 'GET', url, json, callback) ->
|
|||||||
if response?.statusCode >= 400
|
if response?.statusCode >= 400
|
||||||
error = new Error(response.body)
|
error = new Error(response.body)
|
||||||
|
|
||||||
return callback(error, response, body)
|
return callback(error, response, response.body)
|
||||||
|
|
||||||
], callback
|
], callback
|
||||||
|
|
||||||
|
@ -69,6 +69,13 @@ describe 'Server:', ->
|
|||||||
expect(response.body).to.equal(RESPONSE.nojson)
|
expect(response.body).to.equal(RESPONSE.nojson)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it 'should parse the body', (done) ->
|
||||||
|
server.request 'GET', URI.ok, null, (error, response, body) ->
|
||||||
|
expect(error).to.not.exist
|
||||||
|
expect(body).to.be.an.object
|
||||||
|
expect(body).not.to.be.a.string
|
||||||
|
done()
|
||||||
|
|
||||||
it 'should be able to send data in the body', (done) ->
|
it 'should be able to send data in the body', (done) ->
|
||||||
body = { hello: 'world' }
|
body = { hello: 'world' }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user