feat: 支持请求中独立的 Path 字段
Signed-off-by: Ke Jie <chzealot@gmail.com>
This commit is contained in:
parent
f92294fda9
commit
5f78647a9a
|
|
@ -41,7 +41,7 @@ type UserAgentConfig struct {
|
|||
|
||||
func NewDingtalkGoSDKUserAgent() *UserAgentConfig {
|
||||
return &UserAgentConfig{
|
||||
UserAgent: "dingtalk-sdk-go/v0.8.0",
|
||||
UserAgent: "dingtalk-sdk-go/v0.9.0",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import (
|
|||
type GraphRequestLine struct {
|
||||
Method string `json:"method"`
|
||||
Uri string `json:"uri"`
|
||||
Path string `json:"-"`
|
||||
}
|
||||
type GraphRequest struct {
|
||||
RequestLine GraphRequestLine `json:"requestLine"`
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package plugin
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/open-dingtalk/dingtalk-stream-sdk-go/payload"
|
||||
)
|
||||
|
|
@ -29,6 +30,12 @@ func (h *DefaultPluginFrameHandler) OnEventReceived(ctx context.Context, df *pay
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pos := strings.Index(msgData.RequestLine.Uri, "?")
|
||||
if pos >= 0 {
|
||||
msgData.RequestLine.Path = msgData.RequestLine.Uri[:pos]
|
||||
} else {
|
||||
msgData.RequestLine.Path = msgData.RequestLine.Uri
|
||||
}
|
||||
|
||||
if h.defaultHandler == nil {
|
||||
return payload.NewDataFrameResponse(payload.DataFrameResponseStatusCodeKHandlerNotFound), nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue