mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +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
|
||||
error = new Error(response.body)
|
||||
|
||||
return callback(error, response, body)
|
||||
return callback(error, response, response.body)
|
||||
|
||||
], callback
|
||||
|
||||
|
@ -69,6 +69,13 @@ describe 'Server:', ->
|
||||
expect(response.body).to.equal(RESPONSE.nojson)
|
||||
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) ->
|
||||
body = { hello: 'world' }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user