Skip to content

Commit

Permalink
Merge pull request #7 from numary/feat/num-806-payment-cursor-paginat…
Browse files Browse the repository at this point in the history
…ion-is-not-working

fix: payments cursor
  • Loading branch information
gfyrag authored Sep 13, 2022
2 parents 0df0c70 + cefefc0 commit 00291e3
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 40 deletions.
3 changes: 2 additions & 1 deletion benthos/saved_payment.blobl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ map savedPayment {
"scheme": this.payload.scheme,
"type": this.payload.type,
"status": this.payload.status,
"id": this.payload.id
"id": this.payload.id,
"initialAmount": this.payload.initialAmount
},
"kind": "PAYMENT",
"when": this.date
Expand Down
34 changes: 32 additions & 2 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"net/http"
"net/http/httputil"
"os"
"strings"

Expand All @@ -14,7 +15,7 @@ import (
"github.com/numary/go-libs/sharedauth"
sharedhealth "github.com/numary/go-libs/sharedhealth/pkg"
"github.com/numary/go-libs/sharedlogging"
"github.com/numary/go-libs/sharedotlp/sharedotlptraces"
"github.com/numary/go-libs/sharedotlp/pkg/sharedotlptraces"
"github.com/numary/search/pkg/searchengine"
"github.com/numary/search/pkg/searchhttp"
"github.com/opensearch-project/opensearch-go"
Expand Down Expand Up @@ -145,6 +146,33 @@ func exitWithError(logger *logrus.Logger, msg string) {
os.Exit(1)
}

type debugRoundTripper struct {
http.RoundTripper
}

func (d debugRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) {
body, err := httputil.DumpRequest(request, true)
if err != nil {
return nil, err
}
fmt.Println(string(body))

rsp, err := d.RoundTripper.RoundTrip(request)
if err != nil {
return nil, err
}

body, err = httputil.DumpResponse(rsp, true)
if err != nil {
return nil, err
}
fmt.Println(string(body))

return rsp, nil
}

var _ http.RoundTripper = (*debugRoundTripper)(nil)

func opensearchClientModule(openSearchServiceHost string, esIndices ...string) fx.Option {
return fx.Options(
fx.Provide(func() (*opensearch.Client, error) {
Expand All @@ -155,7 +183,9 @@ func opensearchClientModule(openSearchServiceHost string, esIndices ...string) f

return opensearch.NewClient(opensearch.Config{
Addresses: []string{viper.GetString(openSearchSchemeFlag) + "://" + openSearchServiceHost},
Transport: httpTransport,
Transport: &debugRoundTripper{
RoundTripper: httpTransport,
},
})
}),
fx.Invoke(func(lc fx.Lifecycle, client *opensearch.Client) {
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.18
require (
github.com/aquasecurity/esquery v0.2.0
github.com/bombsimon/logrusr/v3 v3.0.0
github.com/davecgh/go-spew v1.1.1
github.com/elastic/go-elasticsearch/v7 v7.17.1
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/numary/go-libs v0.0.0-20220801155717-200c269e800d
github.com/numary/go-libs/sharedhealth v0.0.0-20220801152411-b600be8e0d85
github.com/numary/go-libs v1.0.1
github.com/numary/go-libs/sharedhealth v0.0.0-20220905094731-f6d6d1cf83f3
github.com/numary/go-libs/sharedotlp v0.0.0-20220905094731-f6d6d1cf83f3
github.com/numary/ledger v1.0.0-rc1
github.com/opensearch-project/opensearch-go v1.1.0
github.com/ory/dockertest/v3 v3.8.1
Expand All @@ -21,8 +21,8 @@ require (
github.com/stretchr/testify v1.8.0
github.com/tidwall/gjson v1.14.1
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.33.0
go.opentelemetry.io/otel/trace v1.8.0
go.uber.org/fx v1.17.1
go.opentelemetry.io/otel/trace v1.9.0
go.uber.org/fx v1.18.1
)

require (
Expand All @@ -32,6 +32,7 @@ require (
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/docker/cli v20.10.16+incompatible // indirect
github.com/docker/docker v20.10.16+incompatible // indirect
Expand All @@ -56,7 +57,6 @@ require (
github.com/magiconair/properties v1.8.6 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/numary/go-libs/sharedotlp v0.0.0-20220801155717-200c269e800d // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.2 // indirect
Expand All @@ -73,7 +73,7 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/otel v1.8.0 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 // indirect
Expand All @@ -82,12 +82,12 @@ require (
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 // indirect
go.opentelemetry.io/otel/sdk v1.8.0 // indirect
go.opentelemetry.io/proto/otlp v0.18.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/dig v1.14.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/dig v1.15.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/sys v0.0.0-20220721230656-c6bc011c0c49 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c // indirect
golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220720214146-176da50484ac // indirect
google.golang.org/grpc v1.48.0 // indirect
Expand Down
45 changes: 22 additions & 23 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,12 @@ github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/numary/go-libs v0.0.0-20220801152411-b600be8e0d85 h1:4Fw7M+JcomfAu+YmSuIRpQA5qP7GbBCuh+Fc+gHQQ9A=
github.com/numary/go-libs v0.0.0-20220801152411-b600be8e0d85/go.mod h1:mZQ9h1F6w+3hN3xgfEElJjR2SWLn/ZCWGi67CmQaRkQ=
github.com/numary/go-libs v0.0.0-20220801155717-200c269e800d h1:XbDELISHgFsIkV6T1NM36MRjPU/k5mTZpVbKSwpSG/w=
github.com/numary/go-libs v0.0.0-20220801155717-200c269e800d/go.mod h1:Jsfy6yKwxVaBFFuFL9IVYbMKvepElGQYVoWMhFdK0l0=
github.com/numary/go-libs/sharedhealth v0.0.0-20220801152411-b600be8e0d85 h1:+KA84QMomrNaoHrtrDIRbE4HkUrgu3JAsXcw8XF3OGQ=
github.com/numary/go-libs/sharedhealth v0.0.0-20220801152411-b600be8e0d85/go.mod h1:DzBUp4HCdWscgXmt8/5F/KlCSktv0OwgOwDfRdz5Hzo=
github.com/numary/go-libs/sharedotlp v0.0.0-20220801155717-200c269e800d h1:RPL0L1fFBc1tOO1DQxvQO5Cqx8Nm8U9GmGNGkhvEZus=
github.com/numary/go-libs/sharedotlp v0.0.0-20220801155717-200c269e800d/go.mod h1:AZTmSrMGpNL9GzacAKwYsbSs+1U2ItR9i074hNILq6o=
github.com/numary/go-libs v1.0.1 h1:Q41dz+u+inimZMVgSneCzbtoLiPMTjr1gT3D2UeC7IA=
github.com/numary/go-libs v1.0.1/go.mod h1:u9XNKBrHJSCwu13s85GkEg4TWfRm2CF3fknav4TTLn4=
github.com/numary/go-libs/sharedhealth v0.0.0-20220905094731-f6d6d1cf83f3 h1:ufyCkiNTq5rOeM1ximL4plP9OwCpuXGprSoaXsoGAn0=
github.com/numary/go-libs/sharedhealth v0.0.0-20220905094731-f6d6d1cf83f3/go.mod h1:DzBUp4HCdWscgXmt8/5F/KlCSktv0OwgOwDfRdz5Hzo=
github.com/numary/go-libs/sharedotlp v0.0.0-20220905094731-f6d6d1cf83f3 h1:J87uGw67KBoGGX7uzpCksEXYqX5bTy/atdHa15kRI6E=
github.com/numary/go-libs/sharedotlp v0.0.0-20220905094731-f6d6d1cf83f3/go.mod h1:4QEZTmjeQbNMjWd/pKADguTjxTvAuWgh+ZBWzJ7xDiI=
github.com/numary/ledger v0.0.0-20210702172952-a5bd30e551d0/go.mod h1:u2K28z9TDYd6id1qeD2uv7JDlajuRZ0fvOnCeDZmDxk=
github.com/numary/ledger v0.0.0-20211227131550-dc7b78f85b5b/go.mod h1:uovuDsK7Gs7duqKQ9PgaFulJnPTDftGdR/n3rBRzNIs=
github.com/numary/ledger v1.0.0-rc1 h1:HB1TYCWUvEMuYfWxPbsFt+UZ03MX94H6wUAhnoRkiDw=
Expand Down Expand Up @@ -872,8 +870,8 @@ go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.33
go.opentelemetry.io/contrib/propagators/b3 v1.2.0/go.mod h1:kO8hNKCfa1YmQJ0lM7pzfJGvbXEipn/S7afbOfaw2Kc=
go.opentelemetry.io/otel v1.2.0/go.mod h1:aT17Fk0Z1Nor9e0uisf98LrntPGMnk4frBO9+dkf69I=
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
go.opentelemetry.io/otel v1.8.0 h1:zcvBFizPbpa1q7FehvFiHbQwGzmPILebO0tyqIR5Djg=
go.opentelemetry.io/otel v1.8.0/go.mod h1:2pkj+iMj0o03Y+cW6/m8Y4WkRdYN3AvCXCnzRMp9yvM=
go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw=
go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo=
go.opentelemetry.io/otel/exporters/jaeger v1.3.0/go.mod h1:KoYHi1BtkUPncGSRtCe/eh1ijsnePhSkxwzz07vU0Fc=
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 h1:TLLqD6kDhLPziEC7pgPrMvP9lAqdk3n1gf8DiFSnfW8=
go.opentelemetry.io/otel/exporters/jaeger v1.8.0/go.mod h1:GbWg+ng88rDtx+id26C34QLqw2erqJeAjsCx9AFeHfE=
Expand Down Expand Up @@ -904,8 +902,8 @@ go.opentelemetry.io/otel/sdk/export/metric v0.26.0/go.mod h1:UpqzSnUOjFeSIVQLPp3
go.opentelemetry.io/otel/sdk/metric v0.26.0/go.mod h1:2VIeK0kS1YvRLFg3J58ptZTXYpiWlkq2n5RQt6w7He8=
go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0=
go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
go.opentelemetry.io/otel/trace v1.8.0 h1:cSy0DF9eGI5WIfNwZ1q2iUyGj00tGzP24dE1lOlHrfY=
go.opentelemetry.io/otel/trace v1.8.0/go.mod h1:0Bt3PXY8w+3pheS3hQUt+wow8b1ojPaTBoTCh2zIFI4=
go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc=
go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ=
go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80=
Expand All @@ -915,17 +913,18 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/dig v1.10.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw=
go.uber.org/dig v1.12.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw=
go.uber.org/dig v1.13.0/go.mod h1:X34SnWGr8Fyla9zQNO2GSO2D+TIuqB14OS8JhYocIyw=
go.uber.org/dig v1.14.1 h1:fyakRgZDdi2F8FgwJJoRGangMSPTIxPSLGzR3Oh0/54=
go.uber.org/dig v1.14.1/go.mod h1:52EKx/Vjdpz9EzeNcweC4YMsTrDdFn9mS/+Uw5ZnVTI=
go.uber.org/dig v1.15.0 h1:vq3YWr8zRj1eFGC7Gvf907hE0eRjPTZ1d3xHadD6liE=
go.uber.org/dig v1.15.0/go.mod h1:pKHs0wMynzL6brANhB2hLMro+zalv1osARTviTcqHLM=
go.uber.org/fx v1.13.1/go.mod h1:bREWhavnedxpJeTq9pQT53BbvwhUv7TcpsOqcH4a+3w=
go.uber.org/fx v1.16.0/go.mod h1:OMoT5BnXcOaiexlpjtpE4vcAmzyDKyRs9TRYXCzamx8=
go.uber.org/fx v1.17.1 h1:S42dZ6Pok8hQ3jxKwo6ZMYcCgHQA/wAS/gnpRa1Pksg=
go.uber.org/fx v1.17.1/go.mod h1:yO7KN5rhlARljyo4LR047AjaV6J+KFzd/Z7rnTbEn0A=
go.uber.org/fx v1.18.1 h1:I7VWkdv4iKcbpH7KVSi9Fe1LGmpJv+pbBIb9NidPb+E=
go.uber.org/fx v1.18.1/go.mod h1:g0V1KMQ66zIRk8bLu3Ea5Jt2w/cHlOIp4wdRsgh0JaY=
go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
Expand All @@ -946,8 +945,8 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down Expand Up @@ -1059,8 +1058,8 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0=
golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c h1:JVAXQ10yGGVbSyoer5VILysz6YKjdNT2bsvlayjqhes=
golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1183,8 +1182,8 @@ golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220721230656-c6bc011c0c49 h1:TMjZDarEwf621XDryfitp/8awEhiZNiwgphKlTMGRIg=
golang.org/x/sys v0.0.0-20220721230656-c6bc011c0c49/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24 h1:TyKJRhyo17yWxOMCTHKWrc5rddHORMlnZ/j57umaUd8=
golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
3 changes: 3 additions & 0 deletions pkg/searchengine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func (e *DefaultEngine) doRequest(ctx context.Context, m map[string]interface{})
defer httpResponse.Body.Close()

if httpResponse.IsError() {
if httpResponse.StatusCode == 404 {
return &es.Response{}, nil
}
return nil, errors.New(httpResponse.Status())
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/searchhttp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"encoding/json"
"io"
"io/ioutil"
"math"
"net/http"
"strconv"
Expand Down Expand Up @@ -36,7 +35,7 @@ func resolveQuery(r *http.Request) (*cursorTokenInfo, interface{}, error) {
if err != nil {
return nil, nil, errors.Wrap(err, "first phase decoding")
}
r.Body = ioutil.NopCloser(buf)
r.Body = io.NopCloser(buf)
target = rq.Target
cursorToken = rq.CursorToken
} else {
Expand Down Expand Up @@ -118,6 +117,8 @@ func resolveQuery(r *http.Request) (*cursorTokenInfo, interface{}, error) {
qq.WithSort("address", esquery.OrderDesc)
case "TRANSACTION":
qq.WithSort("txid", esquery.OrderDesc)
case "PAYMENT":
qq.WithSort("reference", esquery.OrderDesc)
}
}
}
Expand Down

0 comments on commit 00291e3

Please sign in to comment.