mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-23 07:22:22 +00:00
Make sure server response body is parsed
This commit is contained in:
parent
97d778634d
commit
b47adaefa4
lib/server
@ -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