Skip to content

Commit

Permalink
feat: decode with TextDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWeber committed Nov 7, 2021
1 parent 5ada382 commit 2d5b8c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/requestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { isMimeTypeJSON, isMimeTypeXml, parseMimeType } from './mimeTypeUtils';
import { default as chalk } from 'chalk';
import { log } from '../io';
import xmlFormat from 'xml-formatter';
import { TextDecoder } from 'util';


export function isHttpRequestMethod(method: string | undefined): method is models.HttpMethod {
Expand Down Expand Up @@ -110,8 +111,7 @@ export function decodeJWT(str: string): JWTToken | null {
return null;
}

const result = Buffer.from(payload, 'base64').toString();

const result = (new TextDecoder()).decode(Buffer.from(payload, 'base64'));
return JSON.parse(result);
} catch (err) {
log.warn(err);
Expand Down

0 comments on commit 2d5b8c7

Please sign in to comment.