Просмотр исходного кода

Support matching query strings

Lu Stadler лет назад: 7
Родитель
Сommit
d199d2f8ea
2 измененных файлов с 1 добавлено и 2 удалено
  1. 0 1
      go/fake-http/README.md
  2. 1 1
      go/fake-http/fake-http.go

+ 0 - 1
go/fake-http/README.md

2
2
3
## TODO
3
## TODO
4
4
5
- support matching query strings
6
- refactoring
5
- refactoring
7
- /_clear endpoint
6
- /_clear endpoint
8
- some kind of templating (request info + random functions?)
7
- some kind of templating (request info + random functions?)

+ 1 - 1
go/fake-http/fake-http.go

335
// Match returns a response definition matching the request.
335
// Match returns a response definition matching the request.
336
func (rs *Responses) Match(req *http.Request) *Response {
336
func (rs *Responses) Match(req *http.Request) *Response {
337
	for _, resp := range *rs {
337
	for _, resp := range *rs {
338
		if req.Method == resp.Method && req.URL.Path == resp.Path {
338
		if req.Method == resp.Method && req.URL.String() == resp.Path {
339
			return &resp
339
			return &resp
340
		}
340
		}
341
	}
341
	}