Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Fix: GET requests for Go codegen (#1216)
Saswata Mukherjee1ad23f4ed874
diff --git a/helpers/codegen/generators/go-native.js b/helpers/codegen/generators/go-native.jsindex 692b9893f..1b484ad17 100644--- a/helpers/codegen/generators/go-native.js+++ b/helpers/codegen/generators/go-native.js@@ -22,7 +22,13 @@ export const GoNativeCodegen = {let genHeaders = []// initial request setuplet requestBody = rawInput ? rawParams : rawRequestBody+ if (method == "GET") {+ requestString.push(+ `req, err := http.NewRequest("${method}", "${url}${pathName}${queryString}")\n`+ )+ }if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {+ genHeaders.push(`req.Header.Set("Content-Type", "${contentType}")\n`)if (isJSONContentType(contentType)) {requestString.push(`var reqBody = []byte(\`${requestBody}\`)\n\n`)requestString.push(@@ -36,7 +42,6 @@ export const GoNativeCodegen = {}// headers- genHeaders.push(`req.Header.Set("Content-Type", "${contentType}")\n`)// authif (auth === "Basic Auth") {const basic = `${httpUser}:${httpPassword}`