Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/testserver.js

Issue 1894183003: Edge case cors preflight race condition (DON'T SUBMIT). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/weird-cors-test-case.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //Lets require/import the HTTP module
2 var http = require('http');
3
4 //Lets define a port we want to listen to
5 const PORT=8888;
6
7 var finish_response = function() {};
8
9 //We need a function which handles requests and send response
10 function handleRequest(request, response) {
11 console.log('URL: "' + request.url + '", method: ' + request.method);
12 if (request.url == '/cors-request') {
13 if (request.method == 'OPTIONS') {
14 finish_response = function() {
15 response.setHeader('Access-Control-Allow-Origin', '*');
16 response.setHeader('Access-Control-Allow-Methods', 'GET, PUT');
17 response.end();
18 }
19 } else {
20 response.setHeader('Access-Control-Allow-Origin', '*');
21 response.end('cors');
22 }
23 } else if (request.url == '/release') {
24 finish_response();
25 finish_response = function() {};
26 response.end('Released!');
27 }
28 }
29
30 //Create a server
31 var server = http.createServer(handleRequest);
32
33 //Lets start our server
34 server.listen(PORT, function(){
35 //Callback triggered when server is successfully listening. Hurray!
36 console.log("Server listening on: http://localhost:%s", PORT);
37 });
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/weird-cors-test-case.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698