-function makeRawRequest (url: string, expectedStatus?: HttpStatusCode, range?: string) {
- const { host, protocol, pathname } = new URL(url)
+function makeRawRequest (options: {
+ url: string
+ token?: string
+ expectedStatus?: HttpStatusCode
+ range?: string
+ query?: { [ id: string ]: string }
+ method?: 'GET' | 'POST'
+}) {
+ const { host, protocol, pathname } = new URL(options.url)
+
+ const reqOptions = {
+ url: `${protocol}//${host}`,
+ path: pathname,
+ contentType: undefined,
+
+ ...pick(options, [ 'expectedStatus', 'range', 'token', 'query' ])
+ }
+
+ if (options.method === 'POST') {
+ return makePostBodyRequest(reqOptions)
+ }