@@ -43,25 +43,22 @@ func HandleAPISuccessResponse(resp *http.Response, out interface{}, sugar *zap.S
4343 sugar .Debug ("Raw HTTP Response" , zap .String ("Body" , string (bodyBytes )))
4444
4545 bodyReader := bytes .NewReader (bodyBytes )
46- mimeType , _ := parseHeader ( resp .Header .Get ("Content-Type" ) )
46+ contentType := resp .Header .Get ("Content-Type" )
4747 contentDisposition := resp .Header .Get ("Content-Disposition" )
4848
49- sugar .Debugf ("MIMETYPE: %s" , mimeType )
50- sugar .Debugf ("NORMAL-HEADER: %s" , resp .Header .Get ("Content-Type" ))
51-
5249 var handler contentHandler
5350 var ok bool
5451
55- if handler , ok = responseUnmarshallers [mimeType ]; ok {
56- return handler (bodyReader , out , sugar , mimeType )
52+ if handler , ok = responseUnmarshallers [contentType ]; ok {
53+ return handler (bodyReader , out , sugar , contentType )
5754 }
5855
59- if isBinaryData (mimeType , contentDisposition ) {
56+ if isBinaryData (contentType , contentDisposition ) {
6057 return handleBinaryData (bodyReader , sugar , out , contentDisposition )
6158 }
6259
63- errMsg := fmt .Sprintf ("unexpected MIME type: %s" , mimeType )
64- sugar .Error ("Unmarshal error" , zap .String ("content type" , mimeType ), zap .Error (errors .New (errMsg )))
60+ errMsg := fmt .Sprintf ("unexpected MIME type: %s" , contentType )
61+ sugar .Error ("Unmarshal error" , zap .String ("content type" , contentType ), zap .Error (errors .New (errMsg )))
6562 return errors .New (errMsg )
6663
6764}
@@ -125,7 +122,7 @@ func handleBinaryData(reader io.Reader, sugar *zap.SugaredLogger, out interface{
125122 }
126123
127124 if contentDisposition != "" {
128- _ , params := parseHeader (contentDisposition )
125+ _ , params := parseDispositionHeader (contentDisposition )
129126 if filename , ok := params ["filename" ]; ok {
130127 sugar .Debug ("Extracted filename from Content-Disposition" , zap .String ("filename" , filename ))
131128 }
0 commit comments