jenkinsci / jenkinsci/http-request-plugin
[JENKINS-47356] A Content-Type header is sent by default with DELETE requests
- Dominant language
- Java
- Stars
- 176
- Forks
- 158
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 3
Description
The following code:
node {
httpRequest url: 'http://localhost:8666',
httpMode: 'DELETE',
requestBody: null,
acceptType: 'NOT_SET',
contentType: 'NOT_SET',
customHeaders: [[name: 'Authorization', value: 'dummy=']],
ignoreSslErrors: true,
validResponseCodes: '100:600'
}
produces the following request:
DELETE / HTTP/1.1
Authorization: dummy=
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Host: localhost:8666
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_91)
Accept-Encoding: gzip,deflate
While the same with a GET:
node {
httpRequest url: 'http://localhost:8666',
httpMode: 'GET',
requestBody: null,
acceptType: 'NOT_SET',
contentType: 'NOT_SET',
customHeaders: [[name: 'Authorization', value: 'dummy=']],
ignoreSslErrors: true,
validResponseCodes: '100:600'
}
produces:
GET / HTTP/1.1
Authorization: dummy=
Host: localhost:8666
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_91)
Accept-Encoding: gzip,deflate
I couldn't pinpoint exactly what part of the code is responsible from this.
This may or may not be related to https://issues.jenkins-ci.org/browse/JENKINS-40873
This would be solved if this issue was implemented: https://issues.jenkins-ci.org/browse/JENKINS-40043
---
Originally reported by lucasc, imported from: A Content-Type header is sent by default with DELETE requests
janario
Raw content of original issue
The following code:
node {
httpRequest url: 'http://localhost:8666',
httpMode: 'DELETE',
requestBody: null,
acceptType: 'NOT_SET',
contentType: 'NOT_SET',
customHeaders: [[name: 'Authorization', value: 'dummy=']],
ignoreSslErrors: true,
validResponseCodes: '100:600'
}produces the following request:
DELETE / HTTP/1.1
Authorization: dummy=
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
Host: localhost:8666
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_91)
Accept-Encoding: gzip,deflateWhile the same with a GET:
node {
httpRequest url: 'http://localhost:8666',
httpMode: 'GET',
requestBody: null,
acceptType: 'NOT_SET',
contentType: 'NOT_SET',
customHeaders: [[name: 'Authorization', value: 'dummy=']],
ignoreSslErrors: true,
validResponseCodes: '100:600'
}produces:
GET / HTTP/1.1
Authorization: dummy=
Host: localhost:8666
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_91)
Accept-Encoding: gzip,deflate
I couldn't pinpoint exactly what part of the code is responsible from this.
This may or may not be related to https://issues.jenkins-ci.org/browse/JENKINS-40873This would be solved if this issue was implemented: https://issues.jenkins-ci.org/browse/JENKINS-40043
- environment:
Tested with v1.8.21
Contributor guide
Assessment
This issue has not been assessed yet.