I'm currently developing a REST API
in which I need to return a 102 HTTP status code
(processing) while I'm generating an export.
Workflow :
- POST /exports
- return 201 with data
- GET /exports/id
- return 102 with data if the export is processing
- return 200 with data if the export is completed
When I try to retrieve export data while it's processing, there are no response headers: response headers are missing with 102 HTTP status code. If I change the status code with 2xx for instance, it's working fine. I can't figure out. Is there anything specific with the 102 HTTP status code? When I say response headers are missing I mean: Chrome > Developer tools > Network Tab > Click on request > Headers tab > Only showing "General" and "Request Headers" (same with FF & Postman)
.
Used Technologies :
- Ubuntu 18.04 LTS
- PHP 7.2 (latest release)
- laravel/lumen 5.6.21
- Apache 2.4.29
Controller Code :
/**
* Return export by id
*
* @param int $id
* @return \Illuminate\Http\JsonResponse
*
* @throws AuthorizationException
* @throws ModelNotFoundException
*/
public function getItem(int $id)
{
if($export = Export::find($id))
{
$this->authorize(__FUNCTION__, $export);
if($export->status != Export::STATUS_COMPLETED)
{
return response()->json($export, 102);
}
return response()->json($export);
}
throw new ModelNotFoundException();
}
Expected Request Headers :
- Access-Control-Allow-Origin
- Cache-Control
- Connection
- Content-Length
- Content-Type
- Date
- Proxy-Connection
- Server
- Vary
EDIT
I should have mentioned that it worked on my previous config :
- Ubuntu 17.10 LTS
- PHP 7.1 (latest release)
- laravel/lumen 5.6.16
- Apache 2.4.27
I haven't found in any release notes what could have impacted the request answer.