Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
update the context lenght header (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin- committed Jul 6, 2018
1 parent 2cdd235 commit 1c5c703
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export default class RestAdapter {

const body = response.body instanceof Object ? JSON.stringify(response.body) : response.body;

if (res.getHeader('Content-Length') != null) {
res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'));
}

res.status(response.status);
write.call(this, body);
};
Expand Down

0 comments on commit 1c5c703

Please sign in to comment.