Documentation
¶
Overview ¶
Copyright 2024 Emin Muhammadi
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Emin Muhammadi ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Emin Muhammadi ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func CreateProxyServer() *http.Server
- func HashSession(ctx *goproxy.ProxyCtx) string
- func IsMockPatternMatches(ctx *goproxy.ProxyCtx) bool
- func MockRequestHandler(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response)
- func MockResponseHandler(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response
- func RequestHandler(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response)
- func ResponseHandler(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response
- func StartProxyServer(server *http.Server)
- type MockPattern
- type PatternConfig
- type ResponseMock
Constants ¶
This section is empty.
Variables ¶
var MockPatterns = func() []MockPattern { patterns := LoadMockPatterns() logger.Log.Println("Loaded mock patterns: ", patterns) return patterns }()
Functions ¶
func CreateProxyServer ¶
func HashSession ¶
func IsMockPatternMatches ¶
func MockRequestHandler ¶
func MockResponseHandler ¶
func RequestHandler ¶
func ResponseHandler ¶
func StartProxyServer ¶
Types ¶
type MockPattern ¶
type MockPattern struct { Method string `yaml:"method"` Host string `yaml:"host"` Path string `yaml:"path"` Response ResponseMock `yaml:"response"` }
func FindPattern ¶
func FindPattern(ctx *goproxy.ProxyCtx) *MockPattern
func LoadMockPatterns ¶
func LoadMockPatterns() []MockPattern
type PatternConfig ¶
type PatternConfig struct {
Patterns []MockPattern `yaml:"patterns"`
}