Closed andyts93 closed 3 years ago
Where are you dumping the headers from?
Also, Scribe doesn't set environment variables. It sets Laravel config variables. So if you specify a value for app.env
, the proper way to check if that was set would be to dump config('app.env')
. If what you want is to set environment variables directly, you can create a .env.docs
file and run the generate command with --env docs
.
I'm dumping from the middleware that checks if the Accept
header is application/json
Thanks for the explanation about the config variables!
I'd suggest you do some more debugging. Take a look at the \Knuckles\Scribe\Extracting\Strategies\Responses\ResponseCalls
class and dump the value of $context['headers']
before prepareRequest()
is called. And then dump$request->getRequestFormat()
after addHeaders()
is called.
Any luck @andyts93 ? Might be able to get on a call sometime.
Any luck @andyts93 ? Might be able to get on a call sometime.
Hi shalvah, I'm sorry but I'm not working on this project now and I'm pretty busy at work so I didn't have the time to do some debug. I'll have to work on this in the next month I guess so I will be able to tell you something more.
Thanks for your willingness!
I've got the same issue. Disclaimer: I'm not a PHP developer and this the first time working with Lumen, so I might be missing the mark horribly. I have managed to narrow it down to the following:
$response = $kernel->handle($request);
).make('request')
make
method creates a new request (stripping the headers and body). I think the issue might be related to the issue described here: https://github.com/laravel/lumen-framework/issues/55 (but I can't be sure).Anyways, (seeing as the abovementioned bug doesn't have a clear solution) I managed to fix this by inserting the following line above line 328 in ResponseCalls.php:
$kernel->alias('Illuminate\Http\Request', 'request');
I know this is kind of hackish, but (with my limited knowledge of PHP) the above line seems to allow the make
method to find a concrete implementation of the request class, so it doesn't create a new one. I'm also assuming the above line is some kind of abomination which will break a thousand other things :)
Hopefully the above explanation puts someone with a deeper understanding of the root issue on the path to a proper fix.
PHP developer or not, that's a pretty smart investigation. I'll take a closer look when I have some time.
I think I've fixed this (2.3.0). Your investigation was pretty similar to another issue: the request wasn't bound in Lumen. Test and let me know if it works now.:
What happened? None of the headers in configuration file are added in the responseCalls. I have the Accept and Content-Type headers in configuration, they are shown correctly in the generated documentation but they are not used during the response call. I also have to set authentication but the bearer token isn't in the headers too (I have the
@authenticated
tag in the controller function). I also noticed the the app.env config isn't setScreenshots and stack traces:
My environment:
php -v
): 7.3.11composer show laravel/framework
orcomposer show lumen/framework
): 7.2.1composer show knuckleswtf/scribe
): 1.4.0My Scribe config (minus the comments):
Additional info: