[BUGFIXES] Header containing ":" + invalid "showresponse" condition (#242)

* [BUGFIX] Header containing ":" values management

* [CHANGE] To pass styleci.io tests

* [BUGFIX] Invalid condition test to display response
This commit is contained in:
Fabien SOMNIER
2018-01-03 09:52:42 +00:00
committed by Marcel Pociot
parent fe58fa263b
commit 4a78f3db0f
2 changed files with 5 additions and 3 deletions

View File

@@ -112,9 +112,11 @@ abstract class AbstractGenerator
// Split headers into key - value pairs
$headers = collect($headers)->map(function ($value) {
$split = explode(':', $value);
$split = explode(':', $value); // explode to get key + values
$key = array_shift($split); // extract the key and keep the values in the array
$value = implode(':', $split); // implode values into string again
return [trim($split[0]) => trim($split[1])];
return [trim($key) => trim($value)];
})->collapse()->toArray();
//Changes url with parameters like /users/{user} to /users/1

View File

@@ -38,7 +38,7 @@ $.ajax(settings).done(function (response) {
});
```
@if(in_array('GET',$parsedRoute['methods']) || isset($parsedRoute['showresponse']) && $parsedRoute['showresponse'])
@if(in_array('GET',$parsedRoute['methods']) || (isset($parsedRoute['showresponse']) && $parsedRoute['showresponse']))
> Example response:
```json