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

Removed duplicated condition for allowedUrls during interceptor logic and make it optional #584

Merged
merged 2 commits into from
Mar 2, 2020

Conversation

adrianbenjuya
Copy link
Contributor

Before this change user needed to define both allowedUrls and customUrlValidation to make customUrlValidation work, otherwise it was never executed.

This way user can define `allowedUrls` or `customUrlValidation` during module import
@jeroenheijmans
Copy link
Collaborator

Took me some time, I think the title of the PR suggests only a deduplication effort, but you are in fact proposing a minor breaking change I think? That is, your new version behaves different in this example scenario:

{
  resourceServer: { 
    customUrlValidation: url => false, // might be complex logic
    allowedUrls: undefined, // !!
  }
}

That's intended, right?

(Shame we have no tests yet, they would help a lot here...)

@adrianbenjuya
Copy link
Contributor Author

adrianbenjuya commented Aug 12, 2019

Took me some time, I think the title of the PR suggests only a deduplication effort, but you are in fact proposing a minor breaking change I think? That is, your new version behaves different in this example scenario:

{
  resourceServer: { 
    customUrlValidation: url => false, // might be complex logic
    allowedUrls: undefined, // !!
  }
}

That's intended, right?

(Shame we have no tests yet, they would help a lot here...)

Yep, the title is incorrect, I just edited it

Indeed, that's what I want to achieve... right now, to make customUrlValidation work I need to define something like this

{
  resourceServer: { 
    customUrlValidation: url => false,
    allowedUrls: []
  }
}

But I expect to define this

{
  resourceServer: { 
    customUrlValidation: url => false
  }
}

Because I'm not interested in setup allowedUrls, just the validations function

@adrianbenjuya adrianbenjuya changed the title Removed duplicated condition for allowedUrls during interceptor logic Removed duplicated condition for allowedUrls during interceptor logic and make it optional Aug 12, 2019
@jeroenheijmans
Copy link
Collaborator

👍 LGTM then. Something for a major release, even though the breaking change is small.

Copy link
Collaborator

@jeroenheijmans jeroenheijmans left a comment

Choose a reason for hiding this comment

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

Fixes the linked issue AFAICT.

Tiny breaking change (for the better), something for v9?

@davebaol
Copy link

Tiny breaking change (for the better), something for v9?

Yep, technically this PR is a breaking change.
However I'm not sure it can be reasonably considered a breaking change, not even minor.

I mean, the only difference is that currently the config below does nothing while with this PR it would execute custom URL validation

{
  resourceServer: { 
    customUrlValidation: url => { /* some complex logic */ },
    allowedUrls: undefined
 }
}

So the real question is "How likely is there someone out there currently using a pointless configuration like that?"
I'd say nobody at all...... Why waiting for v9?

My Two Cents

@manfredsteyer manfredsteyer merged commit b525dab into manfredsteyer:master Mar 2, 2020
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.

4 participants