Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of the base API url validation, it is currently not possible to use a url like
http://localhost/my-proxy/v3
.My specific use case is to proxy the requests to the Mailgun api via a
https://my-internal-server/mailgun/v3
base. I cannot access the Mailgun API directly in the network but I have access tomy-internal-server
.Using
https://my-internal-server/mailgun/v3
, I get an error that readsBaseAPI must end with a /v2, /v3 or /v4
, which it does in my example, but the regex to validate the url is^/v[2-4].*
, which checks if it starts with the version segment.Alltough I think this check could be removed completely (a user will notice the wrong URL when the request is sent, like they would notice a wrong username/password) this PR proposes to change the regex to just
/v[2-4].*
so only the presence of a/v3
segment is validated, no matter where in the URL.I guess it would be better to validate the URL somewhere where the actual
apiBase
field is available so we could actually validate if it ends in/v3
but I did not find a way to implement it without breaking the api. ThehttpRequest
struct does not know about theapiBase
but only sees the fully constructed url which makes the validation for a specific format harder.