Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Polyfills
import {debug} from "../../../ts/src/debug";
const global = Function('return this')();
if (typeof Uint8Array === "undefined") {
(global as any).Uint8Array = require("typedarray").Uint8Array;
}
if (typeof ArrayBuffer === "undefined") {
(global as any).ArrayBuffer = require("typedarray").ArrayBuffer;
}
if (typeof DataView === "undefined") {
(global as any).DataView = require("typedarray").DataView;
}
// Test Config
import {assert} from "chai";
import {
testHost,
corsHost
} from "../../hosts-config";
type TestConfig = {
testHostUrl: string,
corsHostUrl: string,
unavailableHost: string,
emptyHost: string,
// Polyfills
import {debug} from "../../../ts/src/debug";
const global = Function('return this')();
if (typeof Uint8Array === "undefined") {
(global as any).Uint8Array = require("typedarray").Uint8Array;
}
if (typeof ArrayBuffer === "undefined") {
(global as any).ArrayBuffer = require("typedarray").ArrayBuffer;
}
if (typeof DataView === "undefined") {
(global as any).DataView = require("typedarray").DataView;
}
// Test Config
import {assert} from "chai";
import {
testHost,
corsHost
} from "../../hosts-config";
type TestConfig = {
testHostUrl: string,
corsHostUrl: string,
unavailableHost: string,
emptyHost: string,
}
const http1Config: TestConfig = {
testHostUrl: `https://${testHost}:9100`,
var a = new TA.Uint8Array(string.length)
for(var i = 0; i < string.length; i++)
a[i] = string.charCodeAt(i)
return a
}
var zero = '0'.charCodeAt(0)
var A = 'a'.charCodeAt(0)
var HELLOTHERE = new TA.Uint8Array([
104, 101, 108, 108,
111, 32, 116, 104,
101, 114, 101, 46
])
var FOOBARBAZ = new TA.Uint8Array([
102, 111, 111,
98, 97, 114,
98, 97, 112
])
var FOO = toBuffer('foo')
var BAR = toBuffer('bar')
var BAZ = toBuffer('baz')
var FOO64 = FOO.toString('base64')
var BAR64 = BAR.toString('base64')
var BAZ64 = BAZ.toString('base64')
var FOOx = FOO.toString('hex')
var BARx = BAR.toString('hex')
var BAZx = BAZ.toString('hex')
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = bufferFrom(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = bufferFrom(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = bufferFrom(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = new Buffer(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = new Buffer(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = Buffer(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}
function u8Concat (parts) {
var len = 0
for (var i = 0; i < parts.length; i++) {
if (typeof parts[i] === 'string') {
parts[i] = Buffer(parts[i])
}
len += parts[i].length
}
var u8 = new U8(len)
for (var i = 0, offset = 0; i < parts.length; i++) {
var part = parts[i]
for (var j = 0; j < part.length; j++) {
u8[offset++] = part[j]
}
}
return u8
}