HTTP Types in TypeScript
Typescript library to read and write records of HTTP exchanges in the HTTP types format.
Install
$ npm install http-types
Writing HTTP exchanges
Using HttpExchangeWriter
a recording of HTTP traffic can be serialised for use with any program that can handle the HTTP Types format.
; ; ; writer.write; // [...] (write multiple exchanges) // writer.buffer contains the exchanges in the HTTP types JSON Lines format.console.logwriter.buffer;
A HTTP request can also be created from query parameters as an object. The below request is identical to the one created above:
;
Reading HTTP exchanges
With HttpExchangeReader
HTTP Types recordings can be read for processing:
HttpExchangeReader.fromJsonLineswriter.buffer, ;