Skip to content

fix: url preview should contain auth params#7509

Merged
jackkav merged 3 commits intodevelopfrom
fix-preview-auth
Jun 10, 2024
Merged

fix: url preview should contain auth params#7509
jackkav merged 3 commits intodevelopfrom
fix-preview-auth

Conversation

@ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Jun 7, 2024

Changes:

  • fix: url preview should contain auth params

Closes: #7235
Ref: INS-3966

@ihexxa ihexxa self-assigned this Jun 7, 2024
const defaultPreview = '...';

function getQueryParamsFromAuth(auth: RequestAuthentication | {}): RequestParameter[] {
if (!('type' in auth)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!auth.type) {} seems easier to read

Copy link
Contributor

@jackkav jackkav Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built a helper for this getAuthObjectOrNull if this equals null that means auth is not set or empty object or doesn't have .type I've made a suggestion for the change but please test it to confirm. These cases are all possible because request groups can have auth objects but existing ones are uninitialised and therefore undefined. In this case it shouldn't show so perhaps you don't need it.

Suggested change
if (!('type' in auth)) {
if (getAuthObjectOrNull(auth) === null) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me also test this later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also should preview auth fields coming from folders above

jackkav
jackkav previously approved these changes Jun 7, 2024
@jackkav jackkav force-pushed the fix-preview-auth branch from 016d58b to 02205c0 Compare June 10, 2024 10:28
@jackkav jackkav enabled auto-merge (squash) June 10, 2024 10:29
@jackkav jackkav merged commit b60b78f into develop Jun 10, 2024
@jackkav jackkav deleted the fix-preview-auth branch June 10, 2024 10:41
stefancruz pushed a commit to stefancruz/insomnia that referenced this pull request Jun 30, 2024
* fix: url preview should contain auth params

* fix: lint error

* fix auth inheritance

---------

Co-authored-by: jackkav <jackkav@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The API Key is not added to the query parameters

3 participants