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
1=== modified file 'server/acceptance/suites/suite.go'
2--- server/acceptance/suites/suite.go 2014-02-26 19:50:46 +0000
3+++ server/acceptance/suites/suite.go 2014-03-05 17:42:20 +0000
4@@ -78,6 +78,8 @@
5 // KillGroup should be populated by StartServer with functions
6 // to kill the server process
7 KillGroup map[string]func()
8+ // hook to adjust requests
9+ MassageRequest func(req *http.Request) *http.Request
10 // other state
11 httpClient *http.Client
12 }
13@@ -111,6 +113,10 @@
14 request.ContentLength = int64(reader.Len())
15 request.Header.Set("Content-Type", "application/json")
16
17+ if s.MassageRequest != nil {
18+ request = s.MassageRequest(request)
19+ }
20+
21 resp, err := s.httpClient.Do(request)
22 if err != nil {
23 panic(err)

Subscribers

People subscribed via source and target branches