diff --git a/package.json b/package.json index 9cb1e192239..6607e97f432 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "react-addons-shallow-compare": "0.14.8", "react-addons-test-utils": "^15.6.2", "react-collapse": "^4.0.3", + "react-copy-to-clipboard": "5.0.1", "react-debounce-input": "^3.2.0", "react-dom": "^15.6.2", "react-height": "^2.0.0", diff --git a/src/core/components/response-body.jsx b/src/core/components/response-body.jsx index b3ae59250b1..1a590696ac7 100644 --- a/src/core/components/response-body.jsx +++ b/src/core/components/response-body.jsx @@ -2,6 +2,7 @@ import React from "react" import PropTypes from "prop-types" import formatXml from "xml-but-prettier" import lowerCase from "lodash/lowerCase" +import { CopyToClipboard } from "react-copy-to-clipboard" import { extractFileNameFromContentDispositionHeader } from "core/utils" import win from "core/window" @@ -150,7 +151,7 @@ export default class ResponseBody extends React.PureComponent { } return ( !bodyEl ? null :
-
Response body
+
Response body
{ bodyEl }
) diff --git a/src/style/_layout.scss b/src/style/_layout.scss index 812f461eccc..28a6e4e1d55 100644 --- a/src/style/_layout.scss +++ b/src/style/_layout.scss @@ -796,3 +796,11 @@ a.nostyle { cursor: pointer; } } + +button.copy-to-clipboard { + float: right; + border: none; + width: 16x; + height: 20px; + background: url("data:image/svg+xml;utf8,") center center no-repeat; +}