Skip to content

Generated code is incorrect #269

@reefqi037

Description

@reefqi037

Describe the bug
There are a few bugs in the generated code for each request type (JavaScript XHR, Fetch, cURL):

XHR

  • Value of username, password, and headers are not being enclosed in quotes
  • Bearer token header is set incorrectly; 'Bearer ' + <token>

Fetch

  • Value of final header is not properly closed with quotes; "headerKey": "headerValue
  • Authorization token header is not properly closed with quotes;
    "Authorization": "Basic <value>,
    "Authorization": "Bearer Token <token>,
  • Bearer token header is set incorrectly; "Bearer Token <token>"
  • Generated code is not being enclosed properly i.e. copy and run the code will produce SyntaxError

cURL

  • Bearer token header is set incorrectly; 'Bearer Token <value>'

To Reproduce

  1. Set Authentication and add a few Headers
  2. Generate code for each request type

Expected behavior

XHR

  • Value of username, password, and headers are properly enclosed with quotes
  • Bearer token header is set correctly; 'Bearer <token>'

Fetch

  • Value of final header is properly closed with quotes; "headerKey": "headerValue"
  • Authorization token header is properly closed with quotes;
    "Authorization": "Basic <value>",
    "Authorization": "Bearer <token>",
  • Bearer token header is set correctly; "Bearer <token>" (without the Token)
  • Generated code is being enclosed properly

cURL

  • Bearer token header is set correctly; 'Bearer <value>' (without the Token)

Screenshots

XHR
xhr_basic_before
xhr_bearer_before

Fetch
fetch_bearer_before

cURL
curl_bearer_before

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions