You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if $route->httpOnly() return true it return 'http://'.
But Dingo\Api\Routing\Route->httpOnly
public function httpOnly()
{
return in_array('https', $this->action, true)
|| (array_key_exists('https', $this->action) && $this->action['https']);
}
will always return true and tell to create uri starting with http:// instead of https://
public function httpOnly()
{
return in_array('http', $this->action, true);
}
It breaks all tests which assert that uri are returned with the corresponding https option when they are run from a local computer or a CICD which don't use ssl/https server.
Expected Behaviour
Option "https" must force https:// even if the request is not in secure mode.
So httpOnly() should not return true when "https" is used on routes.
/**
* Determine if the route only responds to HTTPS requests.
*
* @return bool
*/
public function secure()
{
return in_array('https', $this->action, true)
|| (array_key_exists('https', $this->action) && $this->action['https']);
}
The text was updated successfully, but these errors were encountered:
Commit that introduced the dysfonction.
3b179df#diff-f006d8a8efa02d74816ed58cff7bbf82
Actual Behaviour
Routes declared with or without "https" option are always returned by the router as http:// instead of https://
Illuminate\Routing\RouteUrlGenerator->getRouteScheme
if $route->httpOnly() return true it return 'http://'.
But Dingo\Api\Routing\Route->httpOnly
will always return true and tell to create uri starting with http:// instead of https://
It breaks all tests which assert that uri are returned with the corresponding https option when they are run from a local computer or a CICD which don't use ssl/https server.
Expected Behaviour
Option "https" must force https:// even if the request is not in secure mode.
So
httpOnly()
should not return true when "https" is used on routes.When we put 'https' or 'https'=>true it force the secure mode so as to always return https uri in transformers.
Steps to Reproduce
Create a route with 'https' or 'https'=>true option
From a controller ask to create an uri from the router.
app('Dingo\Api\Routing\UrlGenerator')->version('v1')->route('products.show', 0208006)
it returns
http://localhost/api/products/0208006
instead ofhttps://localhost/api/products/0208006
Possible Solutions
Revert this commit
3b179df#diff-f006d8a8efa02d74816ed58cff7bbf82
And applies it on httpsOnly/secure method.
The text was updated successfully, but these errors were encountered: