Skip to content

Commit

Permalink
Fixing a couple of issues with authentication
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Shanley <[email protected]>
  • Loading branch information
daveshanley committed Jul 20, 2023
1 parent 79e79e7 commit 1751cac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion daemon/wiretap_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func cloneRequest(request CloneRequest) *http.Request {

// if the auth value is set, we need to base64 encode it and add it to the header.
if request.Auth != "" {
encoded := base64.StdEncoding.EncodeToString([]byte(request.Auth))
encoded := base64.StdEncoding.EncodeToString([]byte(ReplaceWithVariables(request.Variables, request.Auth)))
// this will overwrite any existing auth header.
newReq.Header.Set("Authorization", fmt.Sprintf("Basic %s", encoded))
}
Expand Down
9 changes: 7 additions & 2 deletions ui/src/components/transaction/transaction-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ export class HttpTransactionItemComponent extends LitElement {
reqTime = req.timestamp;
}

const totalTime = respTime - reqTime;
let totalTime = respTime - reqTime;
if (totalTime < 0) {
totalTime = 0;
}

return html`
<div class="${tClass}" @click="${this.setActive}">
Expand All @@ -150,7 +153,9 @@ export class HttpTransactionItemComponent extends LitElement {
</header>
${delay}
<div class="request-time">
${totalTime}ms <sl-icon name="arrow-left-right"></sl-icon>
${(totalTime > 10000) ? html`${(totalTime/1000).toFixed(1)}s` :
html`${totalTime>0 ? totalTime : null}${totalTime>0 ? 'ms' : null}`}
<sl-icon name="arrow-left-right"></sl-icon>
</div>
<div class="transaction-status">
${this.hideControls? '' : chainLink}
Expand Down
7 changes: 4 additions & 3 deletions ui/src/model/extract_status.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import {HttpResponse} from "@/model/http_transaction";

export function ExtractStatusStyleFromCode(response: HttpResponse): string {
if (response.statusCode >= 200 && response.statusCode < 400) {
if (response?.statusCode >= 200 && response?.statusCode < 400) {
return "http200"
}
if (response.statusCode >= 400 && response.statusCode < 500) {
if (response?.statusCode >= 400 && response?.statusCode < 500) {
return "http400"
}
if (response.statusCode >= 500) {
if (response?.statusCode >= 500) {
return "http500"
}
return "pending"
}

export function ExtractHTTPCodeDefinition(response: HttpResponse): string {
Expand Down

0 comments on commit 1751cac

Please sign in to comment.