mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
use subdomain in code gen (#7295)
This commit is contained in:
parent
7cfead4452
commit
db00cdeb88
@ -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>
|
||||
|
@ -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) || '';
|
||||
|
Loading…
Reference in New Issue
Block a user