fix: missing '?' in query parameter string for code generators

This commit is contained in:
liyasthomas
2021-09-13 09:07:06 +05:30
parent c02f54cc18
commit 5d801cf566
21 changed files with 25 additions and 25 deletions

View File

@@ -25,7 +25,7 @@ export const GoNativeCodegen = {
const requestBody = rawInput ? rawParams : rawRequestBody
if (method === "GET") {
requestString.push(
`req, err := http.NewRequest("${method}", "${url}${pathName}${queryString}")\n`
`req, err := http.NewRequest("${method}", "${url}${pathName}?${queryString}")\n`
)
}
if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
@@ -33,11 +33,11 @@ export const GoNativeCodegen = {
if (isJSONContentType(contentType)) {
requestString.push(`var reqBody = []byte(\`${requestBody}\`)\n\n`)
requestString.push(
`req, err := http.NewRequest("${method}", "${url}${pathName}${queryString}", bytes.NewBuffer(reqBody))\n`
`req, err := http.NewRequest("${method}", "${url}${pathName}?${queryString}", bytes.NewBuffer(reqBody))\n`
)
} else if (contentType.includes("x-www-form-urlencoded")) {
requestString.push(
`req, err := http.NewRequest("${method}", "${url}${pathName}${queryString}", strings.NewReader("${requestBody}"))\n`
`req, err := http.NewRequest("${method}", "${url}${pathName}?${queryString}", strings.NewReader("${requestBody}"))\n`
)
}
}