Skip to content

Commit

Permalink
apache#79 modify
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoYL123 committed Feb 29, 2020
1 parent 42cd6ec commit fe24029
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions server/resource/v1/history_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,17 @@ func (r *HistoryResource) GetRevisions(context *restful.Context) {
//GetPollingData get the record of the get or list history
func (r *HistoryResource) GetPollingData(context *restful.Context) {
query := &model.PollingDetail{
Domain: context.ReadQueryParameter("domain"),
SessionID: context.ReadQueryParameter("sessionId"),
IP: context.ReadQueryParameter("ip"),
ID: context.ReadQueryParameter("id"),
URLPath: context.ReadQueryParameter("urlPath"),
UserAgent: context.ReadQueryParameter("userAgent"),
}
domain := ReadDomain(context)
if domain == nil {
WriteErrResponse(context, http.StatusInternalServerError, common.MsgDomainMustNotBeEmpty, common.ContentTypeText)
return
}
query.Domain = domain.(string)
records, err := record.Get(context.Ctx, query)
if err != nil {
if err == service.ErrRecordNotExists {
Expand Down Expand Up @@ -125,7 +129,7 @@ func (r *HistoryResource) URLPatterns() []restful.Route {
},
{
Method: http.MethodGet,
Path: "/v1/{project}/kie/record",
Path: "/v1/{project}/kie/polling_data",
ResourceFunc: r.GetPollingData,
FuncDesc: "get all history record of get and list",
Parameters: []*restful.Parameters{
Expand Down
2 changes: 1 addition & 1 deletion server/resource/v1/history_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestHistoryResource_GetPollingData(t *testing.T) {
assert.Equal(t, kv.Labels, data.Labels)
})
t.Run("get polling data", func(t *testing.T) {
r, _ := http.NewRequest("GET", "/v1/test/kie/record?instanceId=test&domain=default", nil)
r, _ := http.NewRequest("GET", "/v1/test/kie/polling_data?instanceId=test&domain=default", nil)
noopH := &handler2.NoopAuthHandler{}
chain, _ := handler.CreateChain(common.Provider, "testchain1", noopH.Name())
r.Header.Set("Content-Type", "application/json")
Expand Down
2 changes: 1 addition & 1 deletion server/resource/v1/kv_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func init() {
ListenPeerAddr: "127.0.0.1:4000",
AdvertiseAddr: "127.0.0.1:4000",
}
config.Configurations.DB.URI = "mongodb://kie:123@127.0.0.1:27017/kie"
config.Configurations.DB.URI = "mongodb://kie:123@192.168.0.5:27017/kie"
err := service.DBInit()
if err != nil {
panic(err)
Expand Down

0 comments on commit fe24029

Please sign in to comment.