Skip to content

Commit 7216de4

Browse files
author
Paul Gray
committed
Fixing bug where empty POST bodies would fail on NPE
1 parent b04a945 commit 7216de4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/imsglobal/lti/launch/LtiOauthSigner.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ public Map<String, String> signParameters(Map<String, String> parameters, String
8383
private String getRequestBody(HttpRequest req) throws IOException {
8484
if(req instanceof HttpEntityEnclosingRequest){
8585
HttpEntity body = ((HttpEntityEnclosingRequest) req).getEntity();
86-
return IOUtils.toString(body.getContent());
86+
if(body == null) {
87+
return "";
88+
} else {
89+
return IOUtils.toString(body.getContent());
90+
}
8791
} else {
8892
// requests with no entity have an empty string as the body
8993
return "";

0 commit comments

Comments
 (0)