Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Copy as Credentials on Networks Tab #122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions front_end/network/NetworkLogView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ Network.NetworkLogView = class extends UI.VBox {
Common.UIString('Copy as cURL (cmd)'), this._copyCurlCommand.bind(this, request, 'win'), disableIfBlob);
footerSection.appendItem(
Common.UIString('Copy as cURL (bash)'), this._copyCurlCommand.bind(this, request, 'unix'), disableIfBlob);
footerSection.appendItem(UI.copyLinkAddressWithCredentialsLabel(), this._copyLinkAddressWithCredentials.bind(this,request));
footerSection.appendItem(Common.UIString('Copy all as PowerShell'), this._copyAllPowerShellCommand.bind(this));
footerSection.appendItem(Common.UIString('Copy all as fetch'), this._copyAllFetchCall.bind(this));
footerSection.appendItem(Common.UIString('Copy all as cURL (cmd)'), this._copyAllCurlCommand.bind(this, 'win'));
Expand All @@ -1212,6 +1213,7 @@ Network.NetworkLogView = class extends UI.VBox {
Common.UIString('Copy as fetch'), this._copyFetchCall.bind(this, request), disableIfBlob);
footerSection.appendItem(
Common.UIString('Copy as cURL'), this._copyCurlCommand.bind(this, request, 'unix'), disableIfBlob);
footerSection.appendItem(UI.copyLinkAddressWithCredentialsLabel(), this._copyLinkAddressWithCredentials.bind(this,request));
footerSection.appendItem(Common.UIString('Copy all as fetch'), this._copyAllFetchCall.bind(this));
footerSection.appendItem(Common.UIString('Copy all as cURL'), this._copyAllCurlCommand.bind(this, 'unix'));
}
Expand Down Expand Up @@ -1304,6 +1306,28 @@ Network.NetworkLogView = class extends UI.VBox {
InspectorFrontendHost.copyText(commands);
}

/**
*
* @param request
* @returns {Promise<void>}
* @private
*/
async _copyLinkAddressWithCredentials(request) {
const commands = await this.getQueryParameters(request);
InspectorFrontendHost.copyText(commands);
}

/**
*
* @param request
* @returns {Promise<string>}
*/
getQueryParameters(request) {
return request.requestFormData().then(function (data) {
return request._url +"?"+ data;
});
}

/**
* @param {!SDK.NetworkRequest} request
* @param {string} platform
Expand Down
6 changes: 6 additions & 0 deletions front_end/ui/UIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,12 @@ UI.openLinkExternallyLabel = function() {
UI.copyLinkAddressLabel = function() {
return Common.UIString('Copy link address');
};
/**
* @return {string}
*/
UI.copyLinkAddressWithCredentialsLabel = function() {
return Common.UIString('Copy as Credentials');
};

/**
* @return {string}
Expand Down