Skip to content

Commit 0a28fa0

Browse files
committed
Fix async case when no headers are supplied
1 parent 292c5c2 commit 0a28fa0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions/filesystem/file_get_contents.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function file_get_contents(url, flags, context, offset, maxLen) {
7676
var http_options;
7777
if (context) {
7878
http_options = context.stream_options && context.stream_options.http;
79-
http_stream = !! http_options;
79+
http_stream = !!http_options;
8080
}
8181

8282
if (!context || http_stream) {
@@ -174,7 +174,7 @@ function file_get_contents(url, flags, context, offset, maxLen) {
174174
}
175175

176176
if (http_stream) {
177-
var sendHeaders = http_options.header && http_options.header.split(/\r?\n/);
177+
var sendHeaders = (http_options.header && http_options.header.split(/\r?\n/)) || [];
178178
var userAgentSent = false;
179179
for (i = 0; i < sendHeaders.length; i++) {
180180
var sendHeader = sendHeaders[i];

0 commit comments

Comments
 (0)