Index: third_party/WebKit/LayoutTests/http/tests/fetch/resources/useragent-header.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/resources/useragent-header.js b/third_party/WebKit/LayoutTests/http/tests/fetch/resources/useragent-header.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2fbd2aff73b694f6692e36198aa5115bf5771d86 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/resources/useragent-header.js |
@@ -0,0 +1,16 @@ |
+function parse_response(body) { |
+ const lines = body.split('\n'); |
+ for (let line of lines) { |
+ if (line.length == 0) { |
+ continue; |
+ } |
+ const parts = line.split(': ', 2); |
+ if (parts.length < 2) { |
+ return 'ERROR: Invalid line in response: ' + line; |
+ } |
+ if (parts[0] == 'HTTP_USER_AGENT') { |
+ return parts[1]; |
+ } |
+ } |
+ return 'ERROR: User-Agent header not found'; |
+} |