We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05b73da commit a6d207aCopy full SHA for a6d207a
Sources/HTTPServer/Channels/HTTP.ServerMessage.swift
@@ -118,11 +118,19 @@ extension HTTP.ServerMessage
118
}
119
120
self.headers.add(name: "access-control-allow-origin", value: "*")
121
- self.headers.add(name: "content-length", value: "\(length)")
122
- self.headers.add(name: "content-type", value: "\(resource.type)")
+
+ // The rest of these headers should only appear if there is physical content.
123
+ if case nil = buffer
124
+ {
125
+ return
126
+ }
127
128
if resource.gzip
129
{
130
self.headers.add(name: "content-encoding", value: "gzip")
131
132
133
+ self.headers.add(name: "content-length", value: "\(length)")
134
+ self.headers.add(name: "content-type", value: "\(resource.type)")
135
136
0 commit comments