File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1829,27 +1829,31 @@ func (r *Request) Expect() *Response {
18291829 opChain := r .chain .enter ("Expect()" )
18301830 defer opChain .leave ()
18311831
1832- if opChain .failed () {
1833- return newResponse (responseOpts {
1832+ resp := r .expect (opChain )
1833+
1834+ if resp == nil {
1835+ resp = newResponse (responseOpts {
18341836 config : r .config ,
18351837 chain : opChain ,
18361838 })
18371839 }
18381840
1839- if ! r .checkOrder (opChain , "Expect" ) {
1840- return newResponse (responseOpts {
1841- config : r .config ,
1842- chain : opChain ,
1843- })
1841+ return resp
1842+ }
1843+
1844+ func (r * Request ) expect (opChain * chain ) * Response {
1845+ if opChain .failed () {
1846+ return nil
1847+ }
1848+
1849+ if ! r .checkOrder (opChain , "Expect()" ) {
1850+ return nil
18441851 }
18451852
18461853 resp := r .roundTrip (opChain )
18471854
18481855 if resp == nil {
1849- return newResponse (responseOpts {
1850- config : r .config ,
1851- chain : opChain ,
1852- })
1856+ return nil
18531857 }
18541858
18551859 for _ , matcher := range r .matchers {
You can’t perform that action at this time.
0 commit comments