Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using colon as part of URL #171

Closed
AlexeyCL opened this issue Jun 14, 2022 · 1 comment
Closed

using colon as part of URL #171

AlexeyCL opened this issue Jun 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@AlexeyCL
Copy link

AlexeyCL commented Jun 14, 2022

Describe the bug
I tried to send a GET request with a URL, which contains a colon and it failed with error 401.
My request looks like

 const url=`https://${process.env.API_KEY}:${process.env.API_SECRET}@${process.env.URL}/v2/profiles`;
 spec().get(url)

I'm using API_KEY and API_SECRET for the basic authentication, that I provide as part of the URL.
Important to notice, that when I use axios.get(url); it works as required.
As workaround, I can use also Pactum, but with some changes:

const encode=Buffer.from(`${process.env.API_KEY}:${process.env.API_SECRET}`).toString('base64');
 const baseUrl=`https://${process.env.URL}/v2/profiles`;
 await pactum.spec().withHeaders({
         'Authorization': `Basic ${encode}`,
     })
         .get(baseUrl)
         .expectStatus(200);
 });

Expected behavior
could you please check the option to use the first command without basic authorization

Software (please complete the following information):

  • OS: macOS
  • NodeJS Version 14.15.1
@ASaiAnudeep ASaiAnudeep added the bug Something isn't working label Jun 14, 2022
@ASaiAnudeep
Copy link
Member

Tracking it ethan7g/phin#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants