Skip to content

Commit be2b128

Browse files
allow graphql content-types
1 parent a4ea539 commit be2b128

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

module.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,10 @@ func inspectableContentType(s string) bool {
473473
// gRPC (protobuf)
474474
case strings.HasPrefix(s, "application/grpc"):
475475
return true
476+
477+
// GraphQL
478+
case strings.HasPrefix(s, "application/graphql"):
479+
return true
476480
}
477481

478482
return false

module_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ func TestInspectableContentType(t *testing.T) {
270270
{true, "text/x-javascript"},
271271
{true, "text/x-json"},
272272
{true, "application/javascript"},
273+
{true, "application/graphql"},
273274
{false, "octet/stream"},
274275
{false, "junk/yard"},
275276
}
@@ -328,6 +329,7 @@ func TestModule(t *testing.T) {
328329
{genTestRequest("POST", "http://example.com/", "application/rss+xml", `<a>1</a>`), 403, "XSS"},
329330
{genTestRequest("POST", "http://example.com/", "application/rss+xml", `<a>1</a>`), 500, "XSS"},
330331
{genTestRequest("POST", "http://example.com/", "application/rss+xml", `<a>1</a>`), 200, ""},
332+
{genTestRequest("POST", "http://example.com/", "application/graphql", `{}`), 200, ""},
331333
}
332334

333335
for pos, tt := range cases {

0 commit comments

Comments
 (0)