Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ http.OutgoingMessage.prototype.write = function(chunk, encoding) {
var condition =
this._injectPayload && !this._injected &&
encoding === undefined &&
/<!DOCTYPE html>/.test(chunk);
/<!DOCTYPE html>/.test(chunk) &&
/Content-Type: text\/html/.test(this._header);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Seems bit confusing to me?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, a bit odd. But it works with SSR with _escaped_fragment_ this way.


if(condition) {
// if cors headers included if may cause some security holes
Expand Down Expand Up @@ -54,4 +55,4 @@ http.OutgoingMessage.prototype.write = function(chunk, encoding) {
}

originalWrite.call(this, chunk, encoding);
};
};