mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-06-08 08:14:57 +00:00
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
|
|
describe("parsing response headers", function() {
|
|
|
|
// linefeed carriage return
|
|
var lfcr = "\u000d\u000a";
|
|
|
|
it('can parse an empty string', function(){
|
|
|
|
var parsed = parseResponseHeaders('');
|
|
|
|
expect(parsed).toEqual({})
|
|
})
|
|
|
|
it('can parse a single header', function(){
|
|
|
|
var parsed = parseResponseHeaders('x-powered-by: Express');
|
|
|
|
expect(parsed).toEqual({'x-powered-by':'Express'})
|
|
});
|
|
|
|
it('can parse a value containing ": "', function(){
|
|
|
|
var parsed = parseResponseHeaders('x-title: Episode 2: Another episode');
|
|
|
|
expect(parsed).toEqual({'x-title':'Episode 2: Another episode'})
|
|
});
|
|
|
|
it('can parse several headers', function(){
|
|
|
|
var subject = "x-powered-by: Express" + lfcr +
|
|
"Transfer-Encoding: Identity" + lfcr +
|
|
"Connection: keep-alive";
|
|
|
|
var parsed = parseResponseHeaders(subject);
|
|
|
|
expect(parsed).toEqual({
|
|
"x-powered-by": "Express"
|
|
, "Transfer-Encoding": "Identity"
|
|
, "Connection": "keep-alive"
|
|
})
|
|
})
|
|
|
|
}); |