yzt
2023-05-26 2f70f6727314edd84d8ec2bfe3ce832803f1ea77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { parseResponseHeaders } from "../../Source/Cesium.js";
 
describe("Core/parseResponseHeaders", function () {
  it("returns an empty object literal when given falsy input", function () {
    expect(parseResponseHeaders()).toEqual({});
    expect(parseResponseHeaders(null)).toEqual({});
    expect(parseResponseHeaders("")).toEqual({});
  });
 
  it("correctly parses response headers", function () {
    var headerString =
      "Date: Sun, 24 Oct 2004 04:58:38 GMT\r\n" +
      "Server: Apache/1.3.31 (Unix)\r\n" +
      "Keep-Alive: timeout=15, max=99\r\n" +
      "Connection: Keep-Alive\r\n" +
      "Transfer-Encoding: chunked\r\n" +
      "Content-Type: text/plain; charset=utf-8";
    expect(parseResponseHeaders(headerString)).toEqual({
      Date: "Sun, 24 Oct 2004 04:58:38 GMT",
      Server: "Apache/1.3.31 (Unix)",
      "Keep-Alive": "timeout=15, max=99",
      Connection: "Keep-Alive",
      "Transfer-Encoding": "chunked",
      "Content-Type": "text/plain; charset=utf-8",
    });
  });
});