Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
Remove pagination until we decide on how to handle that.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Sep 13, 2018
1 parent 9b1ce42 commit e7ec45e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/open-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const queryString = require('qs')
const fetch = require('node-fetch')
const Headers = fetch.Headers
const camelCase = require('lodash.camelcase')
const { JSONHTTPError, TextHTTPError, HTTPError, getPagination } = require('micro-api-client')
const { JSONHTTPError, TextHTTPError, HTTPError } = require('micro-api-client')

function existy(val) {
return val != null
Expand Down Expand Up @@ -81,6 +81,7 @@ exports.generateMethod = method => {

// TODO: Use micro-api-client when it supports node-fetch
const response = await fetch(path, opts)

const contentType = response.headers.get('Content-Type')

if (contentType && contentType.match(/json/)) {
Expand All @@ -89,8 +90,10 @@ exports.generateMethod = method => {
if (!response.ok) {
throw new JSONHTTPError(response, json)
}
const pagination = getPagination(response)
return pagination ? { pagination, items: json } : json
// TODO: Support pagination
// const pagination = getPagination(response)
// return pagination ? { pagination, items: json } : json
return json
} catch (e) {
throw new HTTPError(response)
}
Expand Down

0 comments on commit e7ec45e

Please sign in to comment.