microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.11.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/networkInspector/requestBodyFormatters/imageFormatter.ts

34lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4/* eslint-disable */
5/* eslint-enable prettier/prettier*/
6
7import { IFormatter, FormattedBody } from "./requestBodyFormatter";
8import { Response } from "../networkMessageData";
9
10/**
11 * @preserve
12 * Start region: the code is borrowed from https://github.com/facebook/flipper/blob/v0.79.1/desktop/plugins/network/RequestDetails.tsx#L482-L497
13 *
14 * Copyright (c) Facebook, Inc. and its affiliates.
15 *
16 * This source code is licensed under the MIT license found in the
17 * LICENSE file in the root directory of this source tree.
18 *
19 * @format
20 */
21
22export class ImageFormatter implements IFormatter {
23 public formatResponse(response: Response, contentType: string): FormattedBody | null {
24 if (contentType.startsWith("image/") && response.data) {
25 return response.data;
26 }
27 return null;
28 }
29}
30
31/**
32 * @preserve
33 * End region: https://github.com/facebook/flipper/blob/v0.79.1/desktop/plugins/network/RequestDetails.tsx#L482-L497
34 */
35