.
This commit is contained in:
1 parent
d2c03d155d
commit
db60190e19
13 files changed
+505
-38
No files matched your search
@@ -1,5 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { EDGE_USER_AGENT, edgeBrowserHeaders, encodeMultipart } from '../electron/main/keyescape-http'
|
||||
import {
|
||||
EDGE_USER_AGENT,
|
||||
edgeBrowserHeaders,
|
||||
encodeMultipart,
|
||||
getKeyescapeTransportMode,
|
||||
setKeyescapeTransportMode,
|
||||
} from '../electron/main/keyescape-http'
|
||||
|
||||
describe('Edge-compatible Keyescape request metadata', () => {
|
||||
it('matches the captured Edge client hints and XHR metadata', () => {
|
||||
@@ -17,6 +23,8 @@ describe('Edge-compatible Keyescape request metadata', () => {
|
||||
expect(headers['Sec-Fetch-Mode']).toBe('cors')
|
||||
expect(headers['Sec-Fetch-Dest']).toBe('empty')
|
||||
expect(headers['X-Requested-With']).toBe('XMLHttpRequest')
|
||||
expect(headers.Origin).toBe('https://www.keyescape.com')
|
||||
expect(headers.Priority).toBe('u=1, i')
|
||||
expect(headers.Referer).toBe('https://www.keyescape.com/reservation2.php')
|
||||
})
|
||||
|
||||
@@ -30,4 +38,12 @@ describe('Edge-compatible Keyescape request metadata', () => {
|
||||
expect(first.body.toString('utf8')).toContain('Content-Disposition: form-data; name="device"')
|
||||
expect(first.body.toString('utf8')).toMatch(/--\r\n$/)
|
||||
})
|
||||
|
||||
it('switches explicitly between the legacy and HTTP/2 transports', () => {
|
||||
setKeyescapeTransportMode('http2')
|
||||
expect(getKeyescapeTransportMode()).toBe('http2')
|
||||
expect(setKeyescapeTransportMode('http2')).toBe(false)
|
||||
expect(setKeyescapeTransportMode('http1')).toBe(true)
|
||||
expect(getKeyescapeTransportMode()).toBe('http1')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user