Last active
December 15, 2016 23:42
-
-
Save mikebronner/c316e1252266b985e78be30aab03a2b9 to your computer and use it in GitHub Desktop.
Prevent Server Timeouts using HTTP Status Code 102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers\Api; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Http\JsonResponse; | |
use Illuminate\Http\Request; | |
class MyController extends Controller | |
{ | |
public function store(Request $request) : JsonResponse | |
{ | |
header('Status: 102 Processing'); | |
// .. do stuff here that takes a long time | |
return response()->json('all done!', 200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment