Skip to content

Commit 9ea8b34

Browse files
committed
HTTP ResponseBody: support HeaderWrites with hard-coded header values.
1 parent 3fd2c7d commit 9ea8b34

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ql/src/semmle/go/concepts/HTTP.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,14 @@ module HTTP {
190190
abstract ResponseWriter getResponseWriter();
191191

192192
/** Gets a content-type associated with this body. */
193-
string getAContentType() { result = getAContentTypeNode().getStringValue() }
193+
string getAContentType() {
194+
exists(HTTP::HeaderWrite hw | hw = getResponseWriter().getAHeaderWrite() |
195+
hw.getHeaderName() = "content-type" and
196+
result = hw.getHeaderValue()
197+
)
198+
or
199+
result = getAContentTypeNode().getStringValue()
200+
}
194201

195202
/** Gets a dataflow node for a content-type associated with this body. */
196203
DataFlow::Node getAContentTypeNode() {

0 commit comments

Comments
 (0)