fix hop http plugin

This commit is contained in:
ginuerzh
2024-01-27 21:28:25 +08:00
parent 8bdd7ee172
commit 43d37d0a5f
2 changed files with 3 additions and 17 deletions

View File

@ -24,10 +24,6 @@ type httpPluginRequest struct {
Src string `json:"src"`
}
type httpPluginResponse struct {
Node string `json:"node"`
}
type httpPlugin struct {
name string
url string
@ -101,18 +97,8 @@ func (p *httpPlugin) Select(ctx context.Context, opts ...hop.SelectOption) *chai
return nil
}
res := httpPluginResponse{}
if err := json.NewDecoder(resp.Body).Decode(&res); err != nil {
p.log.Error(resp.Status)
return nil
}
if res.Node == "" {
return nil
}
var cfg config.NodeConfig
if err := json.NewDecoder(bytes.NewReader([]byte(res.Node))).Decode(&cfg); err != nil {
if err := json.NewDecoder(resp.Body).Decode(&cfg); err != nil {
p.log.Error(err)
return nil
}