Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c8bcc8f44c | ||
|
b45986145c |
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/jar3b/nats-transport
|
||||
module gitlab.connectone.pro/github/nats-transport
|
||||
|
||||
go 1.17
|
||||
|
||||
|
@@ -71,17 +71,17 @@ func (nt NatsTransport) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
// Get Response object from NATS message
|
||||
response := NewResponse()
|
||||
if err := response.ReadFrom(msg.Data); err != nil {
|
||||
return nil, fmt.Errorf("nats_transport: %v", err)
|
||||
return nil, fmt.Errorf("nats_transport: cannot read response from NATS: %v", err)
|
||||
}
|
||||
|
||||
if response.Error != "" {
|
||||
return nil, fmt.Errorf("nats_transport: %s", response.Error)
|
||||
return nil, fmt.Errorf("nats_transport: NATS returns an error: %s", response.Error)
|
||||
}
|
||||
|
||||
// prepare HTTP response
|
||||
httpResponse, err := response.ToHTTPResponse(r)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("nats_transport: %v", err)
|
||||
return nil, fmt.Errorf("nats_transport: cannot convert to HTTP response: %v", err)
|
||||
}
|
||||
|
||||
return httpResponse, nil
|
||||
|
Reference in New Issue
Block a user