Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/util/isjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package util
import "strings"

func IsMediaTypeJson(mediaType string) bool {
return mediaType == "application/json" || strings.HasSuffix(mediaType, "+json")
return strings.HasPrefix(mediaType, "application/json") || strings.HasSuffix(mediaType, "+json")
}
5 changes: 5 additions & 0 deletions pkg/util/isjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ func TestIsMediaTypeJson(t *testing.T) {
mediaType: "application/json",
want: true,
},
{
name: "When MediaType is application/json;version=v1, returns true",
mediaType: "application/json;version=v1",
want: true,
},
{
name: "When MediaType is application/json-patch+json, returns true",
mediaType: "application/json-patch+json",
Expand Down