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

Unified Diff: LayoutTests/http/tests/fetch/script-tests/headers.js

Issue 1288263003: Normalize and update the header value checks to RFC 7230 for Fetch Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/fetch/script-tests/headers.js
diff --git a/LayoutTests/http/tests/fetch/script-tests/headers.js b/LayoutTests/http/tests/fetch/script-tests/headers.js
index 4dd6037237a186f84604b764124bd4815f2e63bb..58a8b699b735c55a66b34477f4f4a75d0a9f2134 100644
--- a/LayoutTests/http/tests/fetch/script-tests/headers.js
+++ b/LayoutTests/http/tests/fetch/script-tests/headers.js
@@ -176,6 +176,37 @@ test(function() {
assert_equals(headers.get('a'), 'b');
assert_equals(headers.get('c'), 'd');
+ // Tests for new valid Headers values.
+ headers = new Headers();
+ headers.set('a', '\xd0\xa1');
+ assert_equals(headers.get('a'), '\xd0\xa1');
+ headers.append('b', 't t');
+ assert_equals(headers.get('b'), 't t');
+ headers.append('c', 't\tt');
+ assert_equals(headers.get('c'), 't\tt');
+ headers.set('k', '');
+ assert_equals(headers.get('k'), '');
+ headers.append('l', ' ');
+ assert_equals(headers.get('l'), '');
+ headers.append('m', '\r\n\r\n\r\n');
+ assert_equals(headers.get('m'), '');
+
+ // Tests for normalizing header values.
+ headers.append('d', ' t');
+ assert_equals(headers.get('d'), 't');
+ headers.set('e', 't ');
+ assert_equals(headers.get('d'), 't');
+ headers.append('f', ' t ');
+ assert_equals(headers.get('f'), 't');
+ headers.append('g', 'test\r');
+ assert_equals(headers.get('g'), 'test');
+ headers.set('h', 'test\n');
+ assert_equals(headers.get('h'), 'test');
+ headers.append('i', 'test\r\n');
+ assert_equals(headers.get('i'), 'test');
+ headers.append('j', 'test\t');
+ assert_equals(headers.get('j'), 'test');
+
// Throw errors
INVALID_HEADER_NAMES.forEach(function(name) {
assert_throws({name: 'TypeError'},
« no previous file with comments | « LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js ('k') | Source/modules/fetch/FetchHeaderList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698