mirror of
https://github.com/aykhans/sarin.git
synced 2026-02-28 06:49:13 +00:00
Build request data through RequestData struct instead of fasthttp directly
Refactor request generators to populate a script.RequestData intermediate struct, then apply it to fasthttp.Request in one step. This eliminates the round-trip conversion (fasthttp → RequestData → fasthttp) when scripts are enabled. Remove the URL field from RequestData and the now-unused fasthttp conversion functions from chain.go.
This commit is contained in:
@@ -86,7 +86,6 @@ func (e *JsEngine) requestDataToObject(req *RequestData) goja.Value {
|
||||
obj := e.runtime.NewObject()
|
||||
|
||||
_ = obj.Set("method", req.Method)
|
||||
_ = obj.Set("url", req.URL)
|
||||
_ = obj.Set("path", req.Path)
|
||||
_ = obj.Set("body", req.Body)
|
||||
|
||||
@@ -130,11 +129,6 @@ func (e *JsEngine) objectToRequestData(val goja.Value, req *RequestData) error {
|
||||
req.Method = v.String()
|
||||
}
|
||||
|
||||
// URL
|
||||
if v := obj.Get("url"); v != nil && !goja.IsUndefined(v) {
|
||||
req.URL = v.String()
|
||||
}
|
||||
|
||||
// Path
|
||||
if v := obj.Get("path"); v != nil && !goja.IsUndefined(v) {
|
||||
req.Path = v.String()
|
||||
|
||||
Reference in New Issue
Block a user