Skip to content

Commit

Permalink
Use transformer for getFileContents as string
Browse files Browse the repository at this point in the history
fixes #267
  • Loading branch information
perry-mitchell committed Aug 14, 2021
1 parent 06d9062 commit 443c359
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/operations/getFileContents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
WebDAVClientContext
} from "../types";

const TRANSFORM_RETAIN_FORMAT = (v: any) => v;

export async function getFileContents(
context: WebDAVClientContext,
filePath: string,
Expand Down Expand Up @@ -62,7 +64,8 @@ async function getFileContentsString(
{
url: joinURL(context.remoteURL, encodePath(filePath)),
method: "GET",
responseType: "text"
responseType: "text",
transformResponse: [TRANSFORM_RETAIN_FORMAT]
},
context,
options
Expand Down
1 change: 1 addition & 0 deletions source/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ interface RequestOptionsBase {
method: string;
onUploadProgress?: UploadProgressCallback;
responseType?: string;
transformResponse?: Array<(value: any) => any>;
url?: string;
validateStatus?: (status: number) => boolean;
withCredentials?: boolean;
Expand Down

0 comments on commit 443c359

Please sign in to comment.