Skip to content

Commit

Permalink
feat: Allow CJS imports
Browse files Browse the repository at this point in the history
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
  • Loading branch information
Richienb committed Nov 18, 2019
1 parent ff089e1 commit 60b3e2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import _ from "lodash"
* @param content The content to convert.
* @param headers HTTP Headers provided with a request.
*/
export function convertBody(content: Buffer | string, headers?: Headers): string {
export default function convertBody(content: Buffer | string, headers?: Headers): string {
// Try to extract content-type header
const contentType = !_.isNil(headers) ? headers.get("content-type") : null

Expand Down Expand Up @@ -72,3 +72,4 @@ export function convertBody(content: Buffer | string, headers?: Headers): string
)
}

module.exports = convertBody
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from "ava"
import { Headers } from "node-fetch"
import { encode } from "iconv-lite"
import _ from "lodash"
import { convertBody } from "./src"
import convertBody from "./src"

test("should support encoding decode, xml dtd detect", (t) => {
const text = "<?xml version=\"1.0\" encoding=\"EUC-JP\"?><title>日本語</title>"
Expand Down

0 comments on commit 60b3e2e

Please sign in to comment.