-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Affects: 5.2.9.RELEASE
According to the specification RFC https://tools.ietf.org/html/rfc7231#section-4.3.2
The server SHOULD send the same
header fields in response to a HEAD request as it would have sent if
the request had been a GET, except that the payload header fields
(Section 3.3) MAY be omitted.
This is the endpoint
private final DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory();
@GetMapping("/headers")
public ResponseEntity<Flux<DataBuffer>> testHeadersGET() {
return ResponseEntity
.ok()
.body(Flux.defer(() -> {
byte[] bytes = "variableLengthString".getBytes();
return Flux.just(dataBufferFactory.wrap(bytes));
}));
}
With GET request these are the request/response headers
GET /headers HTTP/1.1
Host: localhost:8080
Accept: */*
HTTP/1.1 200 OK
transfer-encoding: chunked
Content-Type: text/event-stream
With HEAD request these are the request/response headers
GET /headers HTTP/1.1
Host: localhost:8080
Accept: */*
HTTP/1.1 200 OK
Content-Type: text/event-stream
Content-Length: 20
In the first case with GET, transfer-encoding
is used, while in the case with HEAD it is Content-Length: 20
. Why is that?
Also additional question why Spring Framework decides to return Content-Type: text/event-stream
as it is not specified that this is SSE.
This is related to reactor/reactor-netty#1333
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug