mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
bugfix: deal with empty base_url
This commit is contained in:
@@ -118,7 +118,7 @@ func TestMakeTestCaseFromHAR(t *testing.T) {
|
||||
if !assert.Equal(t, map[string]interface{}{"foo1": "HDnY8", "foo2": 12.3}, tCase.TestSteps[1].Request.Body) {
|
||||
t.Fatal()
|
||||
}
|
||||
if !assert.Equal(t, "foo1=HDnY8&foo2=12.3", tCase.TestSteps[2].Request.Body) {
|
||||
if !assert.Equal(t, map[string]string{"foo1": "HDnY8", "foo2": "12.3"}, tCase.TestSteps[2].Request.Body) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ func TestMakeRequestDataParams(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
if !assert.Equal(t, "a=1&b=2", step.Request.Body) {
|
||||
if !assert.Equal(t, map[string]string{"a": "1", "b": "2"}, step.Request.Body) {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,10 @@ func (r *requestBuilder) prepareUrlParams(stepVariables map[string]interface{})
|
||||
log.Error().Err(err).Msg("parse request url failed")
|
||||
return err
|
||||
}
|
||||
baseURL := stepVariables["base_url"].(string)
|
||||
var baseURL string
|
||||
if stepVariables["base_url"] != nil {
|
||||
baseURL = stepVariables["base_url"].(string)
|
||||
}
|
||||
rawUrl := buildURL(baseURL, convertString(requestUrl))
|
||||
|
||||
// prepare request params
|
||||
|
||||
Reference in New Issue
Block a user