[#1083] objsvc/v2: Properly check response status after forwarding

Previously we had cryptic error:
```
debug   get/remote.go:38        remote call failed      {"component": "Object.Get service", "request": "HEAD", "address": "9sTxoVrhJ7WBtXQfK2NJ7zDV5yCF7BPLKK1XTxYPdGsP/BbHV4KZZ8y2BPqAT5kyjdHRLkfbtY2xf5uYoMVqxACn1", "raw": false, "local": false, "with session": false, "with bearer": false, "error": "unexpected header type <nil>"}
```
Now we have and expected error:
```
debug   get/remote.go:38        remote call failed      {"component": "Object.Get service", "request": "HEAD", "address": "D2rqaMG4D2VHdv3HKky8UYSYmwQFH2v9oXXqtyRZPTMy/BbHV4KZZ8y2BPqAT5kyjdHRLkfbtY2xf5uYoMVqxACn1", "raw": false, "local": false, "with session": false, "with bearer": false, "error": "status: code = 2049 message = object not found"}
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-05-15 11:51:38 +03:00
parent b4cfc80579
commit 300654b045
2 changed files with 1 additions and 3 deletions

View file

@ -24,7 +24,6 @@ import (
type headRequestForwarder struct { type headRequestForwarder struct {
Request *objectV2.HeadRequest Request *objectV2.HeadRequest
Response *objectV2.HeadResponse
OnceResign sync.Once OnceResign sync.Once
ObjectAddr oid.Address ObjectAddr oid.Address
Key *ecdsa.PrivateKey Key *ecdsa.PrivateKey
@ -172,5 +171,5 @@ func (f *headRequestForwarder) verifyResponse(headResp *objectV2.HeadResponse, p
return errResponseVerificationFailed(err) return errResponseVerificationFailed(err)
} }
return checkStatus(f.Response.GetMetaHeader().GetStatus()) return checkStatus(headResp.GetMetaHeader().GetStatus())
} }

View file

@ -249,7 +249,6 @@ func (s *Service) toHeadPrm(req *objectV2.HeadRequest, resp *objectV2.HeadRespon
forwarder := &headRequestForwarder{ forwarder := &headRequestForwarder{
Request: req, Request: req,
Response: resp,
ObjectAddr: objAddr, ObjectAddr: objAddr,
Key: key, Key: key,
} }