Skip to content

Commit

Permalink
new test for empty string, null and undefined values
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallvord R. M. Steen committed Oct 25, 2013
1 parent 1706ea5 commit a2a1aa5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions XMLHttpRequest/setrequestheader-allow-empty-value.htm
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>XMLHttpRequest: setRequestHeader() - empty header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[4]/p[contains(@class,'note')] /following::ol/li[6]" />
</head>
<body>
<div id="log"></div>
<script>
function request(value) {
test(function() {
var client = new XMLHttpRequest()
client.open("POST", "resources/inspect-headers.php?filter_name=X-Empty", false)
client.setRequestHeader('X-Empty', value)
client.send(null)
assert_equals(client.responseText, 'x-empty: '+ String(value).toLowerCase()+'\n' )
}, document.title + " (" + value + ")")
}
request("")
request(null)
request(undefined)
</script>
</body>
</html>

0 comments on commit a2a1aa5

Please sign in to comment.