Skip to content

Commit fa035d0

Browse files
committed
Return empty string when we have no response headers; fix phoboslab#533
1 parent fc15954 commit fa035d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Source/Ejecta/EJUtils/EJBindingHttpRequest.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
184184
}
185185

186186
EJ_BIND_FUNCTION(getAllResponseHeaders, ctx, argc, argv) {
187-
if( !response || ![response isKindOfClass:[NSHTTPURLResponse class]] ) {
187+
if( !response ) {
188188
return NULL;
189189
}
190+
if( ![response isKindOfClass:[NSHTTPURLResponse class]] ) {
191+
NSStringToJSValue(ctx, @"");
192+
}
190193

191194
NSHTTPURLResponse *urlResponse = (NSHTTPURLResponse *)response;
192195
NSMutableString *headers = [NSMutableString string];

0 commit comments

Comments
 (0)