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

Side by Side Diff: tools/testing/dart/http_server.dart

Issue 11678011: Adding test for validating that formdata is sent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « tests/html/form_data_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library http_server; 5 library http_server;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 import 'test_suite.dart'; // For TestUtils. 9 import 'test_suite.dart'; // For TestUtils.
10 10
(...skipping 24 matching lines...) Expand all
35 resp.headers.set("Access-Control-Allow-Origin", "*"); 35 resp.headers.set("Access-Control-Allow-Origin", "*");
36 file.openInputStream().pipe(resp.outputStream); 36 file.openInputStream().pipe(resp.outputStream);
37 } else { 37 } else {
38 resp.statusCode = HttpStatus.NOT_FOUND; 38 resp.statusCode = HttpStatus.NOT_FOUND;
39 resp.outputStream.close(); 39 resp.outputStream.close();
40 } 40 }
41 }); 41 });
42 } 42 }
43 }; 43 };
44 44
45 // Echos back the contents of the request as the response data.
46 _httpServer.addRequestHandler((req) => req.path == "/echo", (request, resp) {
47 resp.headers.set("Access-Control-Allow-Origin", "*");
48
49 request.inputStream.pipe(resp.outputStream);
50 });
51
45 _httpServer.listen(host, port); 52 _httpServer.listen(host, port);
46 } 53 }
47 54
48 terminateHttpServer() { 55 terminateHttpServer() {
49 if (_httpServer != null) _httpServer.close(); 56 if (_httpServer != null) _httpServer.close();
50 } 57 }
OLDNEW
« no previous file with comments | « tests/html/form_data_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698