(method string, path string, query url.Values)
| 89 | } |
| 90 | |
| 91 | func QueryMatcher(method string, path string, query url.Values) Matcher { |
| 92 | return func(req *http.Request) bool { |
| 93 | if !REST(method, path)(req) { |
| 94 | return false |
| 95 | } |
| 96 | |
| 97 | actualQuery := req.URL.Query() |
| 98 | |
| 99 | for param := range query { |
| 100 | if !(actualQuery.Get(param) == query.Get(param)) { |
| 101 | return false |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | return true |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | func readBody(req *http.Request) ([]byte, error) { |
| 110 | bodyCopy := &bytes.Buffer{} |