update ts fetch petstore samples

This commit is contained in:
wing328 2017-07-23 02:24:18 +08:00
parent e710405778
commit b54bd0581a
2 changed files with 30 additions and 20 deletions

View File

@ -199,9 +199,10 @@ export const PetApiFetchParamCreator = {
}
const baseUrl = `/pet/findByStatus`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = Object.assign({}, urlObj.query, {
"status": params["status"],
});
urlObj.query = Object.assign({}, urlObj.query);
if (params["status"] !== undefined) {
urlObj.query["status"] = params["status"];
}
let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};
@ -233,9 +234,10 @@ export const PetApiFetchParamCreator = {
}
const baseUrl = `/pet/findByTags`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = Object.assign({}, urlObj.query, {
"tags": params["tags"],
});
urlObj.query = Object.assign({}, urlObj.query);
if (params["tags"] !== undefined) {
urlObj.query["tags"] = params["tags"];
}
let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};
@ -1115,10 +1117,13 @@ export const UserApiFetchParamCreator = {
}
const baseUrl = `/user/login`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = Object.assign({}, urlObj.query, {
"username": params["username"],
"password": params["password"],
});
urlObj.query = Object.assign({}, urlObj.query);
if (params["username"] !== undefined) {
urlObj.query["username"] = params["username"];
}
if (params["password"] !== undefined) {
urlObj.query["password"] = params["password"];
}
let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};

View File

@ -200,9 +200,10 @@ export const PetApiFetchParamCreator = {
}
const baseUrl = `/pet/findByStatus`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = assign({}, urlObj.query, {
"status": params["status"],
});
urlObj.query = assign({}, urlObj.query);
if (params["status"] !== undefined) {
urlObj.query["status"] = params["status"];
}
let fetchOptions: RequestInit = assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};
@ -234,9 +235,10 @@ export const PetApiFetchParamCreator = {
}
const baseUrl = `/pet/findByTags`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = assign({}, urlObj.query, {
"tags": params["tags"],
});
urlObj.query = assign({}, urlObj.query);
if (params["tags"] !== undefined) {
urlObj.query["tags"] = params["tags"];
}
let fetchOptions: RequestInit = assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};
@ -1116,10 +1118,13 @@ export const UserApiFetchParamCreator = {
}
const baseUrl = `/user/login`;
let urlObj = url.parse(baseUrl, true);
urlObj.query = assign({}, urlObj.query, {
"username": params["username"],
"password": params["password"],
});
urlObj.query = assign({}, urlObj.query);
if (params["username"] !== undefined) {
urlObj.query["username"] = params["username"];
}
if (params["password"] !== undefined) {
urlObj.query["password"] = params["password"];
}
let fetchOptions: RequestInit = assign({}, { method: "GET" }, options);
let contentTypeHeader: Dictionary<string> = {};