Skip to content

Commit 60b3e2e

Browse files
committed
feat: Allow CJS imports
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
1 parent ff089e1 commit 60b3e2e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import _ from "lodash"
3636
* @param content The content to convert.
3737
* @param headers HTTP Headers provided with a request.
3838
*/
39-
export function convertBody(content: Buffer | string, headers?: Headers): string {
39+
export default function convertBody(content: Buffer | string, headers?: Headers): string {
4040
// Try to extract content-type header
4141
const contentType = !_.isNil(headers) ? headers.get("content-type") : null
4242

@@ -72,3 +72,4 @@ export function convertBody(content: Buffer | string, headers?: Headers): string
7272
)
7373
}
7474

75+
module.exports = convertBody

test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from "ava"
22
import { Headers } from "node-fetch"
33
import { encode } from "iconv-lite"
44
import _ from "lodash"
5-
import { convertBody } from "./src"
5+
import convertBody from "./src"
66

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

0 commit comments

Comments
 (0)