diff --git a/addon/web/client/src/utils.js b/addon/web/client/src/utils.js index fb50dc9..10109a1 100644 --- a/addon/web/client/src/utils.js +++ b/addon/web/client/src/utils.js @@ -9,8 +9,14 @@ export const isTextResponse = response => { export const getSize = response => { if (!response) return '0' if (!response.header) return '0' - if (!response.header['Content-Length']) return '0' - const len = parseInt(response.header['Content-Length'][0]) + + let len + if (response.header['Content-Length']) { + len = parseInt(response.header['Content-Length'][0]) + } else if (response && response.body) { + len = response.body.byteLength + } + if (!len) return '0' if (isNaN(len)) return '0' if (len <= 0) return '0' diff --git a/addon/web/message.go b/addon/web/message.go index 9022c4f..c90c773 100644 --- a/addon/web/message.go +++ b/addon/web/message.go @@ -81,7 +81,8 @@ func newMessageResponse(f *flow.Flow) *message { } func newMessageResponseBody(f *flow.Flow) *message { - return newMessage(messageTypeResponseBody, f.Id, f.Response.Body) + body, _ := f.Response.DecodedBody() + return newMessage(messageTypeResponseBody, f.Id, body) } func (m *message) bytes() []byte { diff --git a/cmd/mitmproxy/main.go b/cmd/mitmproxy/main.go index 020ec1b..eba9b76 100644 --- a/cmd/mitmproxy/main.go +++ b/cmd/mitmproxy/main.go @@ -54,7 +54,6 @@ func main() { p.AddAddon(dumper) } - p.AddAddon(&addon.Decoder{}) p.AddAddon(web.NewWebAddon(config.webAddr)) log.Fatal(p.Start())