diff --git a/src/app/services/actions/snippet-action-creator.ts b/src/app/services/actions/snippet-action-creator.ts index bb8e94438..78c2f30a5 100644 --- a/src/app/services/actions/snippet-action-creator.ts +++ b/src/app/services/actions/snippet-action-creator.ts @@ -4,26 +4,26 @@ import { parseSampleUrl } from '../../utils/sample-url-generation'; import { GET_SNIPPET_ERROR, GET_SNIPPET_PENDING, - GET_SNIPPET_SUCCESS + GET_SNIPPET_SUCCESS, } from '../redux-constants'; export function getSnippetSuccess(response: string): IAction { return { type: GET_SNIPPET_SUCCESS, - response + response, }; } export function getSnippetError(response: object): IAction { return { type: GET_SNIPPET_ERROR, - response + response, }; } export function getSnippetPending(): any { return { - type: GET_SNIPPET_PENDING + type: GET_SNIPPET_PENDING, }; } @@ -41,16 +41,17 @@ export function getSnippet(language: string): Function { } if (language !== 'csharp') { snippetsUrl += `?lang=${language}`; - if (language === 'go') { - snippetsUrl += '&generation=openapi'; - } + } + const openApiSnippets: string[] = ['go', 'powershell']; + if (openApiSnippets.includes(language)) { + snippetsUrl += '&generation=openapi'; } dispatch(getSnippetPending()); const method = 'POST'; const headers = { - 'Content-Type': 'application/http' + 'Content-Type': 'application/http', }; // eslint-disable-next-line max-len const body = `${sampleQuery.selectedVerb} /${queryVersion}/${