Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Commit

Permalink
updating changelog for v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GRECO, FRANK committed Aug 10, 2017
1 parent 715bdd9 commit 4d65fba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Improved test coverage.
### Changed
- Changed visibility `route` type members in the `steps` package to private.
- Upgraded to Go version 1.8.3
- Resolved bug that did not handle potential panics from plugins.
- Fixed typos in README.
Expand Down
16 changes: 8 additions & 8 deletions steps/mockservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ import (
type mock []route

type route struct {
route string `json:"route"`
code int `json:"code"`
method string `json:"method"`
body interface{} `json:"body"`
Route string `json:"route"`
Code int `json:"code"`
Method string `json:"method"`
Body interface{} `json:"body"`
}

// MockServiceStep is factory that defines a step responsible for
Expand Down Expand Up @@ -132,7 +132,7 @@ func (step MockServiceStep) Do(ctx context.Context, c *controller.Controller, w
// to find a match
for i, currRoute := range m {

if strings.Compare(currRoute.route, targetPath) == 0 && strings.Compare(strings.ToUpper(currRoute.method), r.Method) == 0 {
if strings.Compare(currRoute.Route, targetPath) == 0 && strings.Compare(strings.ToUpper(currRoute.Method), r.Method) == 0 {
mockRespIndex = i
break
}
Expand All @@ -155,7 +155,7 @@ func (step MockServiceStep) Do(ctx context.Context, c *controller.Controller, w
// we're going to require it be JSON however.
// we're going to attempt to marshal it into jsonpath
// and pass it along
mockBodyData, err := json.Marshal(m[mockRespIndex].body)
mockBodyData, err := json.Marshal(m[mockRespIndex].Body)
if err != nil {
return utils.StatusError{Code: http.StatusInternalServerError, Err: fmt.Errorf("the configmap %s in the namespace %s is not formated correctly. while data was found for the incoming route, it was not valid json",
proxy.Spec.Mock.ConfigMapName,
Expand All @@ -173,12 +173,12 @@ func (step MockServiceStep) Do(ctx context.Context, c *controller.Controller, w

// create a fake response
responseRecorder := &httptest.ResponseRecorder{
Code: m[mockRespIndex].code,
Code: m[mockRespIndex].Code,
Body: bytes.NewBuffer(mockBodyData),
HeaderMap: upstreamHeaders,
}

ctx = monitor.AddCtxMetric(ctx, "http_response_code", strconv.Itoa(m[mockRespIndex].code))
ctx = monitor.AddCtxMetric(ctx, "http_response_code", strconv.Itoa(m[mockRespIndex].Code))

*resp = *responseRecorder.Result()

Expand Down

0 comments on commit 4d65fba

Please sign in to comment.