Skip to content

Commit

Permalink
Fix NIOHTTP1Server handleJustWrite always using response status "ok" (#…
Browse files Browse the repository at this point in the history
…755)

Motivation:

Addressing the #713

Modifications:

Forward the statusCode from NIOHTTP1Server main handleJustWrite to ctx.writeAndFlush instead of always using "ok"

Result:

ChannelHandlerContext will write the correct status code even when it's not "ok"
  • Loading branch information
JovanMilenkovic authored and Lukasa committed Jan 18, 2019
1 parent 8f3ac9a commit f50230a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/NIOHTTP1Server/main.swift
Expand Up @@ -173,7 +173,7 @@ private final class HTTPHandler: ChannelInboundHandler {
case .head(let request):
self.keepAlive = request.isKeepAlive
self.state.requestReceived()
ctx.writeAndFlush(self.wrapOutboundOut(.head(httpResponseHead(request: request, status: .ok))), promise: nil)
ctx.writeAndFlush(self.wrapOutboundOut(.head(httpResponseHead(request: request, status: statusCode))), promise: nil)
case .body(buffer: _):
()
case .end:
Expand Down

0 comments on commit f50230a

Please sign in to comment.