From 95b5b1063b584014ce9af7ffa62d84afff197549 Mon Sep 17 00:00:00 2001 From: Arthur Lacoste Date: Thu, 16 Mar 2023 16:43:42 +0100 Subject: [PATCH] Fix HTTP request crash when the response does not contain a `Content-Type` header. Fixes: https://github.com/DontShaveTheYak/jenkins-std-lib/issues/305 --- src/org/dsty/http/Requests.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/dsty/http/Requests.groovy b/src/org/dsty/http/Requests.groovy index 0f5911d48..2b9334368 100644 --- a/src/org/dsty/http/Requests.groovy +++ b/src/org/dsty/http/Requests.groovy @@ -153,7 +153,7 @@ class Requests implements Serializable { Response response = handleRequest(connection) - if (response.headers?.'Content-Type'.contains('application/json')) { + if (response.headers?.'Content-Type'?.contains('application/json') == true) { JsonSlurperClassic slurper = new JsonSlurperClassic() response.json = slurper.parseText(response.body) }