From 6b00a53a3a279c28b15efb91e4606117a52ec7a2 Mon Sep 17 00:00:00 2001 From: Dirk Rudolph Date: Mon, 10 Feb 2020 15:52:32 +0100 Subject: [PATCH] Extend regex to support optional charset on the media types --- apisprout.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apisprout.go b/apisprout.go index 44fc633..467ca88 100644 --- a/apisprout.go +++ b/apisprout.go @@ -51,8 +51,8 @@ var ( ) var ( - marshalJSONMatcher = regexp.MustCompile(`^application/(vnd\..+\+)?json$`) - marshalYAMLMatcher = regexp.MustCompile(`^(application|text)/(x-|vnd\..+\+)?yaml$`) + marshalJSONMatcher = regexp.MustCompile(`^application/(vnd\..+\+)?json(; ?charset=.+)?$`) + marshalYAMLMatcher = regexp.MustCompile(`^(application|text)/(x-|vnd\..+\+)?yaml(; ?charset=.+)?$`) ) type RefreshableRouter struct {