Skip to content

Instantly share code, notes, and snippets.

@gagregrog
Created October 27, 2020 19:35
Show Gist options
  • Save gagregrog/413cb3490e67f1d6e63bcc3aff52bc44 to your computer and use it in GitHub Desktop.
Save gagregrog/413cb3490e67f1d6e63bcc3aff52bc44 to your computer and use it in GitHub Desktop.
Request UW COVID-19 Test Results
const fetch = require('node-fetch');
const { URLSearchParams } = require('url');
const METHOD = 'POST';
const URL = 'https://securelink.labmed.uw.edu/result';
const getTestResultsAsHtml = async ({ dob, barcode }) => {
if (!(dob && barcode)) {
throw new Error('dob and code are required');
}
const params = new URLSearchParams();
params.append('dob', dob);
params.append('barcode', barcode);
console.log('Checking for updated results...\n');
// using URLSearchParams, the Content-Type header is set automatically
const res = await fetch(URL, { method: METHOD, body: params });
return res.text();
}
module.exports = getTestResultsAsHtml;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment