From 8bd67c9f7f0c7adeb396f9a9b745ce4bd7208f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=C5=ADlo=20Ebermann?= Date: Tue, 4 Apr 2017 08:47:22 +0200 Subject: [PATCH] Fix template directory used by samples script. (#5284) --- bin/security/typescript-fetch.sh | 2 +- .../petstore-security-test/typescript-fetch/api.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/security/typescript-fetch.sh b/bin/security/typescript-fetch.sh index 17c61cf26ed..6b8757a5fb9 100755 --- a/bin/security/typescript-fetch.sh +++ b/bin/security/typescript-fetch.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/typescript-fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/TypeScript-Fetch -i modules/swagger-codegen/src/test/resources/2_0/petstore-security-test.yaml -l typescript-fetch -o samples/client/petstore-security-test/typescript-fetch" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore-security-test/typescript-fetch/api.ts b/samples/client/petstore-security-test/typescript-fetch/api.ts index 6936a0ffb53..adff476ae84 100644 --- a/samples/client/petstore-security-test/typescript-fetch/api.ts +++ b/samples/client/petstore-security-test/typescript-fetch/api.ts @@ -51,7 +51,7 @@ export interface ModelReturn { /** * FakeApi - fetch parameter creator */ -export const FakeApiFetchParamCreactor = { +export const FakeApiFetchParamCreator = { /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r @@ -61,9 +61,9 @@ export const FakeApiFetchParamCreactor = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; - fetchOptions.body = querystring.stringify({ + fetchOptions.body = querystring.stringify({ "test code inject */ ' " =end -- \r\n \n \r": params["test code inject * ' " =end rn n r"], }); if (contentTypeHeader) { @@ -84,8 +84,8 @@ export const FakeApiFp = { * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param test code inject * ' " =end rn n r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r */ - testCodeInjectEndRnNR(params: { "test code inject * ' " =end rn n r"?: string; }, options?: any): (fetch: FetchAPI, basePath?: string) => Promise { - const fetchArgs = FakeApiFetchParamCreactor.testCodeInjectEndRnNR(params, options); + testCodeInjectEndRnNR(params: { "test code inject * ' " =end rn n r"?: string; }, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const fetchArgs = FakeApiFetchParamCreator.testCodeInjectEndRnNR(params, options); return (fetch: FetchAPI = isomorphicFetch, basePath: string = BASE_PATH) => { return fetch(basePath + fetchArgs.url, fetchArgs.options).then((response) => { if (response.status >= 200 && response.status < 300) {