Merge lp:~pedronis/ubuntu-push/acceptance-massage-req-hook into lp:ubuntu-push

Proposed by Samuele Pedroni
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 78
Merged at revision: 78
Proposed branch: lp:~pedronis/ubuntu-push/acceptance-massage-req-hook
Merge into: lp:ubuntu-push
Diff against target: 23 lines (+6/-0)
1 file modified
server/acceptance/suites/suite.go (+6/-0)
To merge this branch: bzr merge lp:~pedronis/ubuntu-push/acceptance-massage-req-hook
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+209511@code.launchpad.net

Commit message

[trivial] hook to massage requests sent to the http api server by the acceptance test suite

Description of the change

hook to massage requests sent to the http api server by the acceptance test suite

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'server/acceptance/suites/suite.go'
--- server/acceptance/suites/suite.go 2014-02-26 19:50:46 +0000
+++ server/acceptance/suites/suite.go 2014-03-05 17:42:20 +0000
@@ -78,6 +78,8 @@
78 // KillGroup should be populated by StartServer with functions78 // KillGroup should be populated by StartServer with functions
79 // to kill the server process79 // to kill the server process
80 KillGroup map[string]func()80 KillGroup map[string]func()
81 // hook to adjust requests
82 MassageRequest func(req *http.Request) *http.Request
81 // other state83 // other state
82 httpClient *http.Client84 httpClient *http.Client
83}85}
@@ -111,6 +113,10 @@
111 request.ContentLength = int64(reader.Len())113 request.ContentLength = int64(reader.Len())
112 request.Header.Set("Content-Type", "application/json")114 request.Header.Set("Content-Type", "application/json")
113115
116 if s.MassageRequest != nil {
117 request = s.MassageRequest(request)
118 }
119
114 resp, err := s.httpClient.Do(request)120 resp, err := s.httpClient.Do(request)
115 if err != nil {121 if err != nil {
116 panic(err)122 panic(err)

Subscribers

People subscribed via source and target branches