Skip to content

Commit 22050fc

Browse files
committed
define headers according to output_format
1 parent 59807d5 commit 22050fc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "unstructured-client",
33
"version": "0.18.1",
44
"author": "Unstructured",
5-
"main": "src/index.js",
5+
"main": "./index.js",
66
"sideEffects": false,
77
"repository": {
88
"type": "git",

src/funcs/generalPartition.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,19 @@ export async function generalPartition(
245245

246246
const path = pathToFunc("/general/v0/general")();
247247

248+
let acceptHeader = "application/json";
249+
if (payload.partition_parameters.output_format) {
250+
switch (payload.partition_parameters.output_format) {
251+
case "text/csv":
252+
acceptHeader = "text/csv";
253+
break;
254+
default:
255+
acceptHeader = "application/json";
256+
}
257+
}
258+
248259
const headers = new Headers({
249-
Accept: payload.partition_parameters.output_format,
260+
Accept: acceptHeader,
250261
"unstructured-api-key": encodeSimple(
251262
"unstructured-api-key",
252263
payload["unstructured-api-key"],

0 commit comments

Comments
 (0)