mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Small customization HAReplyEncoder
This commit is contained in:
@@ -38,21 +38,6 @@ func newHADataProvider(dpType string,
|
||||
}
|
||||
}
|
||||
|
||||
// httpAgentReplyEncoder will encode []*engine.NMElement
|
||||
// and write content to http writer
|
||||
type httpAgentReplyEncoder interface {
|
||||
encode(*engine.NavigableMap) error
|
||||
}
|
||||
|
||||
// newHAReplyEncoder constructs a httpAgentReqDecoder based on encoder type
|
||||
func newHAReplyEncoder(encType string,
|
||||
w http.ResponseWriter) (rE httpAgentReplyEncoder, err error) {
|
||||
switch encType {
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported encoder type <%s>", encType)
|
||||
}
|
||||
}
|
||||
|
||||
func newHTTPUrlDP(req *http.Request) (dP engine.DataProvider, err error) {
|
||||
dP = &httpUrlDP{req: req, cache: engine.NewNavigableMap(nil)}
|
||||
return
|
||||
@@ -102,3 +87,18 @@ func (hU *httpUrlDP) AsNavigableMap([]*config.CfgCdrField) (
|
||||
nm *engine.NavigableMap, err error) {
|
||||
return nil, utils.ErrNotImplemented
|
||||
}
|
||||
|
||||
// httpAgentReplyEncoder will encode []*engine.NMElement
|
||||
// and write content to http writer
|
||||
type httpAgentReplyEncoder interface {
|
||||
encode(*engine.NavigableMap) error
|
||||
}
|
||||
|
||||
// newHAReplyEncoder constructs a httpAgentReqDecoder based on encoder type
|
||||
func newHAReplyEncoder(encType string,
|
||||
w http.ResponseWriter) (rE httpAgentReplyEncoder, err error) {
|
||||
switch encType {
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported encoder type <%s>", encType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,3 +47,13 @@ Host: api.cgrates.org
|
||||
t.Errorf("received: <%s>", data)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
<?xml version="1.0"?>
|
||||
<response status="success">
|
||||
<api_call>SampleAPIMethod</api_call>
|
||||
<SIM>
|
||||
<PublicNumber>497924804904</PublicNumber>
|
||||
</SIM>
|
||||
</response>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user