ruby-net-http.js (hoppscotch-2.0.0) | : | ruby-net-http.js (hoppscotch-2.1.0) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
const verbs = [ | const verbs = [ | |||
{ verb: "GET", rbMethod: "Get" }, | { verb: "GET", rbMethod: "Get" }, | |||
{ verb: "POST", rbMethod: "Post" }, | { verb: "POST", rbMethod: "Post" }, | |||
{ verb: "PUT", rbMethod: "Put" }, | { verb: "PUT", rbMethod: "Put" }, | |||
{ verb: "PATCH", rbMethod: "Patch" }, | { verb: "PATCH", rbMethod: "Patch" }, | |||
{ verb: "DELETE", rbMethod: "Delete" }, | { verb: "DELETE", rbMethod: "Delete" }, | |||
] | ] | |||
// create URI and request | // create URI and request | |||
const verb = verbs.find((v) => v.verb === method) | const verb = verbs.find((v) => v.verb === method) | |||
requestString.push(`uri = URI.parse('${url}${pathName}${queryString}')\n`) | requestString.push(`uri = URI.parse('${url}${pathName}?${queryString}')\n`) | |||
requestString.push(`request = Net::HTTP::${verb.rbMethod}.new(uri)`) | requestString.push(`request = Net::HTTP::${verb.rbMethod}.new(uri)`) | |||
// content type | // content type | |||
if (contentType) { | if (contentType) { | |||
requestString.push(`request['Content-Type'] = '${contentType}'`) | requestString.push(`request['Content-Type'] = '${contentType}'`) | |||
} | } | |||
// custom headers | // custom headers | |||
if (headers) { | if (headers) { | |||
headers.forEach(({ key, value }) => { | headers.forEach(({ key, value }) => { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |