diff --git a/devtools/client/netmonitor/src/components/CustomRequestPanel.js b/devtools/client/netmonitor/src/components/CustomRequestPanel.js index 7af69bae327a..d521d67bf196 100644 --- a/devtools/client/netmonitor/src/components/CustomRequestPanel.js +++ b/devtools/client/netmonitor/src/components/CustomRequestPanel.js @@ -125,10 +125,26 @@ class CustomRequestPanel extends Component { : { method: val.trim() }; break; case "custom-postdata-value": + // Update "content-length" header value to reflect change + // in post data field. + const { requestHeaders } = request; + const newHeaders = requestHeaders.headers.map(header => { + if (header.name.toLowerCase() == "content-length") { + return { + name: header.name, + value: val.length, + }; + } + return header; + }); + data = { requestPostData: { postData: { text: val }, }, + requestHeaders: { + headers: newHeaders, + }, }; break; case "custom-query-value":