Skip to content

Commit

Permalink
Render full HTTP test URL (#82)
Browse files Browse the repository at this point in the history
render full http test url
  • Loading branch information
hbeckmann authored Feb 7, 2025
1 parent 950affe commit 0c3341b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func renderer(
case step.CLICommand != nil && results[i].CLICommandResult != nil:
renderCLICommand(*step.CLICommand, *results[i].CLICommandResult, failure, isSubmit, ch, i)
case step.HTTPRequest != nil && results[i].HTTPRequestResult != nil:
renderHTTPRequest(*step.HTTPRequest, *results[i].HTTPRequestResult, failure, isSubmit, ch, i)
renderHTTPRequest(*step.HTTPRequest, *results[i].HTTPRequestResult, failure, isSubmit, data.BaseURL, ch, i)
default:
cobra.CheckErr("unable to run lesson: missing results")
}
Expand Down Expand Up @@ -467,13 +467,21 @@ func renderHTTPRequest(
result api.HTTPRequestResult,
failure *api.StructuredErrCLI,
isSubmit bool,
baseURL *string,
ch chan tea.Msg,
index int,
) {
url := req.Request.Path
url := ""
overrideBaseURL := viper.GetString("override_base_url")
if overrideBaseURL != "" {
url = overrideBaseURL
} else if baseURL != nil && *baseURL != "" {
url = *baseURL
}
if req.Request.FullURL != "" {
url = req.Request.FullURL
}
url += req.Request.Path
ch <- startStepMsg{
url: checks.InterpolateVariables(url, result.Variables),
method: req.Request.Method,
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.16.1
v1.16.2

0 comments on commit 0c3341b

Please sign in to comment.