httpexpect icon indicating copy to clipboard operation
httpexpect copied to clipboard

fix: preserve query from RequestFactory

Open vmihailenco opened this issue 8 months ago • 1 comments

httpexpect.Request holds a copy of query in r.query, but fails to copy/sync the query set in the RequestFactory.

vmihailenco avatar Aug 05 '25 10:08 vmihailenco

I also tried to write a test for TestExpect_RequestFactory, but it is not easy because encodeRequest is not called there and this code is never executed:

func (r *Request) encodeRequest(opChain *chain) bool {
	r.httpReq.URL.Path = concatPaths(r.httpReq.URL.Path, r.path)

	if r.query != nil {
		r.httpReq.URL.RawQuery = r.query.Encode()           <--- here the query is overriden
	}

vmihailenco avatar Aug 05 '25 10:08 vmihailenco