Skip to content

Commit 291715c

Browse files
committed
Fix bug where duplicated Send tab would stop syncing headers
This meant if you duplicated a tab with a body and correct content-length field, they'd go out of sync.
1 parent 5ddef60 commit 291715c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/send/send-tabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export const SendTabs = observer((props: {
221221
{
222222
type: 'option',
223223
label: 'Duplicate Tab',
224-
callback: () => props.onAddTab(_.cloneDeep(request.request))
224+
callback: () => props.onAddTab(new RequestInput(request.request))
225225
},
226226
{
227227
type: 'option',

src/model/send/send-request-model.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class RequestInput {
3939
url: string,
4040
headers: RawHeaders,
4141
requestContentType: EditableContentType,
42-
rawBody: Buffer
42+
rawBody: Buffer | EditableBody
4343
}
4444
) {
4545
// When deserializing, we need to ensure the body is provided directly
@@ -49,8 +49,13 @@ export class RequestInput {
4949
this.url = existingData.url;
5050
this.headers = existingData.headers;
5151
this.requestContentType = existingData.requestContentType;
52+
53+
const rawBody = existingData.rawBody instanceof EditableBody
54+
? existingData.rawBody.decoded
55+
: existingData.rawBody;
56+
5257
this.rawBody = new EditableBody(
53-
existingData.rawBody,
58+
rawBody,
5459
undefined,
5560
() => this.headers
5661
);

0 commit comments

Comments
 (0)