use subdomain in code gen (#7295)

This commit is contained in:
Jack Kavanagh 2024-04-23 12:19:20 +02:00 committed by GitHub
parent 7cfead4452
commit db00cdeb88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ export const MockUrlBar = ({ onPathUpdate, onSend }: { onPathUpdate: (path: stri
label="Generate Client Code"
onClick={async () => {
const request = await models.request.getByParentId(mockRoute._id);
request && showModal(GenerateCodeModal, { request });
request && showModal(GenerateCodeModal, { request: { ...request, url: getMockServiceBinURL(mockRoute.parentId, pathInput, mockServer.useInsomniaCloud ? undefined : mockServer.url) } });
}}
/>
</DropdownItem>

View File

@ -1,7 +1,7 @@
import type { HTTPSnippetClient, HTTPSnippetTarget } from 'httpsnippet';
import React, { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';
import { exportHarRequest } from '../../../common/har';
import { exportHarWithRequest } from '../../../common/har';
import { Request } from '../../../models/request';
import { CopyButton } from '../base/copy-button';
import { Dropdown, DropdownButton, DropdownItem, ItemContent } from '../base/dropdown';
@ -81,7 +81,7 @@ export const GenerateCodeModal = forwardRef<GenerateCodeModalHandle, Props>((pro
// Some clients need a content-length for the request to succeed
const addContentLength = Boolean((TO_ADD_CONTENT_LENGTH[targetOrFallback.key] || []).find(c => c === clientOrFallback.key));
const har = await exportHarRequest(request._id, props.environmentId, addContentLength);
const har = await exportHarWithRequest(request, props.environmentId, addContentLength);
if (har) {
const snippet = new HTTPSnippet(har);
const cmd = snippet.convert(targetOrFallback.key, clientOrFallback.key) || '';