diff --git a/internal_packages/worker-ui/lib/developer-bar-curl-item.cjsx b/internal_packages/worker-ui/lib/developer-bar-curl-item.cjsx index 9a17da4da..848ea3b0f 100644 --- a/internal_packages/worker-ui/lib/developer-bar-curl-item.cjsx +++ b/internal_packages/worker-ui/lib/developer-bar-curl-item.cjsx @@ -21,7 +21,7 @@ class DeveloperBarCurlItem extends React.Component _onCopyCommand: => clipboard = require('electron').clipboard - clipboard.writeText(@props.item.command) + clipboard.writeText(@props.item.commandWithAuth) _isError: -> return false if @props.item.statusCode is "pending" @@ -38,7 +38,7 @@ class DeveloperBarCurlItem extends React.Component fs = require 'fs-plus' if fs.existsSync(curlFile) fs.unlinkSync(curlFile) - fs.writeFileSync(curlFile, @props.item.command) + fs.writeFileSync(curlFile, @props.item.commandWithAuth) fs.chmodSync(curlFile, '777') {shell} = require 'electron' shell.openItem(curlFile) diff --git a/internal_packages/worker-ui/lib/developer-bar-store.coffee b/internal_packages/worker-ui/lib/developer-bar-store.coffee index f8cc731e4..426dab850 100644 --- a/internal_packages/worker-ui/lib/developer-bar-store.coffee +++ b/internal_packages/worker-ui/lib/developer-bar-store.coffee @@ -7,10 +7,13 @@ moment = require 'moment' class DeveloperBarCurlRequest constructor: ({@id, request, statusCode, error}) -> url = request.url + urlWithAuth = url if request.auth and (request.auth.user || request.auth.pass) - url = url.replace('://', "://#{request.auth.user ? ""}:#{request.auth.pass ? ""}@") + urlWithAuth = url.replace('://', "://#{request.auth.user ? ""}:#{request.auth.pass ? ""}@") + if request.qs url += "?#{qs.stringify(request.qs)}" + urlWithAuth += "?#{qs.stringify(request.qs)}" postBody = "" postBody = JSON.stringify(request.body).replace(/'/g, '\\u0027') if request.body @@ -27,7 +30,9 @@ class DeveloperBarCurlRequest tok = request.auth.bearer.replace("!", "\\!") headers += "-H \"Authorization: Bearer #{tok}\" " - @command = "curl -X #{request.method} #{headers}#{data} \"#{url}\"" + baseCommand = "curl -X #{request.method} #{headers}#{data}" + @command = baseCommand + " \"#{url}\"" + @commandWithAuth = baseCommand + " \"#{urlWithAuth}\"" @statusCode = statusCode ? error?.code ? "pending" @errorMessage = error?.message ? error @startMoment = moment(request.startTime)