Show HTTP path segments as a list of strings in the right pane (#641)

* Show HTTP path segments as a list of strings in the right pane

* Use better variable names
This commit is contained in:
M. Mert Yıldıran
2022-01-16 09:43:52 +03:00
committed by GitHub
parent 4db8e8902b
commit 59fbe4c479
2 changed files with 32 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ import (
"log"
"net/http"
"net/url"
"strings"
"time"
"github.com/up9inc/mizu/tap/api"
@@ -209,6 +210,7 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
request["url"] = reqDetails["url"].(string)
reqDetails["targetUri"] = reqDetails["url"]
reqDetails["path"] = path
reqDetails["pathSegments"] = strings.Split(path, "/")[1:]
reqDetails["summary"] = path
// Rearrange the maps for the querying
@@ -296,6 +298,15 @@ func representRequest(request map[string]interface{}) (repRequest []interface{})
Data: string(details),
})
pathSegments := request["pathSegments"].([]interface{})
if len(pathSegments) > 1 {
repRequest = append(repRequest, api.SectionData{
Type: api.TABLE,
Title: "Path Segments",
Data: representSliceAsTable(pathSegments, `request.pathSegments`),
})
}
repRequest = append(repRequest, api.SectionData{
Type: api.TABLE,
Title: "Headers",