fix: handle double charset everywhere by using our ParseMediaType

This commit is contained in:
James Houlahan
2020-06-03 07:39:16 +02:00
parent 80b2bfc2a5
commit 45e99caa23
5 changed files with 14 additions and 11 deletions

View File

@ -24,7 +24,6 @@ import (
"fmt"
"io"
"io/ioutil"
"mime"
"mime/multipart"
"net/http"
"net/textproto"
@ -32,6 +31,8 @@ import (
"strings"
"testing"
pmmime "github.com/ProtonMail/proton-bridge/pkg/mime"
"github.com/stretchr/testify/assert"
)
@ -96,7 +97,7 @@ func TestClient_CreateAttachment(t *testing.T) {
s, c := newTestServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Ok(t, checkMethodAndPath(r, "POST", "/attachments"))
contentType, params, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
contentType, params, err := pmmime.ParseMediaType(r.Header.Get("Content-Type"))
if err != nil {
t.Error("Expected no error while parsing request content type, got:", err)
}