Skip to content

Commit ff446cf

Browse files
Update SentryService.cfc
Handle when getHTTPRequestData is null Happens when called via java.util.concurrent.CompletableFuture
1 parent ec1ee2a commit ff446cf

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

models/SentryService.cfc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ component accessors=true singleton {
629629
var signature = "";
630630
var header = "";
631631
var timeVars = getTimeVars();
632-
var httpRequestData = getHTTPRequestData();
632+
var httpRequestData = getHTTPDataForRequest();
633633

634634
// Add global metadata
635635
arguments.captureStruct[ "event_id" ] = lCase( replace( createUUID(), "-", "", "all" ) );
@@ -869,7 +869,7 @@ component accessors=true singleton {
869869
* Get Real IP, by looking at clustered, proxy headers and locally.
870870
*/
871871
private function getRealIP(){
872-
var headers = getHTTPRequestData().headers;
872+
var headers = getHTTPDataForRequest().headers;
873873

874874
// When going through a proxy, the IP can be a delimtied list, thus we take the last one in the list
875875

@@ -982,4 +982,18 @@ component accessors=true singleton {
982982
return normalizedPath.replace( "//", "/", "all" );
983983
}
984984

985+
/**
986+
* I return the http request data
987+
*/
988+
struct function getHTTPDataForRequest() {
989+
try {
990+
var result = getHTTPRequestData();
991+
if ( !isNull( result ) ) {
992+
return result;
993+
}
994+
} catch ( any e ) {
995+
}
996+
return { "headers" : {}, "content" : "" };
997+
}
998+
985999
}

0 commit comments

Comments
 (0)