UNPKG

httpsnippet

Version:

HTTP Request snippet generator for *most* languages

12 lines (11 loc) 341 B
"use strict"; var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('readystatechange', function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open('POST', 'http://mockbin.com/har'); xhr.setRequestHeader('Content-Type', 'multipart/form-data'); xhr.send(data);