Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fetcher for gzipped body #39

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ LICENSE.txt

src/wrapper
src/index.ts
src/core/fetcher/Fetcher.ts

.github/workflows/ci.yml
2 changes: 2 additions & 0 deletions src/core/fetcher/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse
if (args.body instanceof FormData) {
// @ts-expect-error
body = args.body;
} else if (args.body instanceof Uint8Array) {
body = args.body;
} else {
body = JSON.stringify(args.body);
}
Expand Down
22 changes: 21 additions & 1 deletion src/wrapper/RecordsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ export class Records extends FernRecords {
* Adds records to a workbook sheet
* @throws {@link Flatfile.BadRequestError}
* @throws {@link Flatfile.NotFoundError}
*
* @example
* await flatfile.records.insert("us_sh_YOUR_ID", [{
* "firstName": {
* value: undefined,
* messages: [],
* valid: true
* },
* "lastName": {
* value: undefined,
* messages: [],
* valid: true
* },
* "email": {
* value: undefined,
* messages: [],
* valid: true
* }
* }])
*/
public async insert(
sheetId: Flatfile.SheetId,
Expand All @@ -39,12 +58,13 @@ export class Records extends FernRecords {
"X-Disable-Hooks": "true",
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@flatfile/api",
"X-Fern-SDK-Version": "1.5.27",
"X-Fern-SDK-Version": "1.7.0",
...gzipHeaders,
},
contentType: "application/json",
body,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return await serializers.RecordsResponse.parseOrThrow(_response.body, {
Expand Down
Loading