mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-08 20:47:43 +00:00
ensuring we capture empty responses
Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -61,18 +61,6 @@ func LocateRefNodeWithContext(ctx context.Context, root *yaml.Node, idx *index.S
|
|||||||
// run through everything and return as soon as we find a match.
|
// run through everything and return as soon as we find a match.
|
||||||
// this operates as fast as possible as ever
|
// this operates as fast as possible as ever
|
||||||
collections := generateIndexCollection(idx)
|
collections := generateIndexCollection(idx)
|
||||||
|
|
||||||
// if there are any external indexes being used by remote
|
|
||||||
// documents, then we need to search through them also.
|
|
||||||
//externalIndexes := idx.GetAllExternalIndexes()
|
|
||||||
//if len(externalIndexes) > 0 {
|
|
||||||
// var extCollection []func() map[string]*index.Reference
|
|
||||||
// for _, extIndex := range externalIndexes {
|
|
||||||
// extCollection = generateIndexCollection(extIndex)
|
|
||||||
// collections = append(collections, extCollection...)
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
var found map[string]*index.Reference
|
var found map[string]*index.Reference
|
||||||
for _, collection := range collections {
|
for _, collection := range collections {
|
||||||
found = collection()
|
found = collection()
|
||||||
@@ -98,7 +86,6 @@ func LocateRefNodeWithContext(ctx context.Context, root *yaml.Node, idx *index.S
|
|||||||
|
|
||||||
// perform a search for the reference in the index
|
// perform a search for the reference in the index
|
||||||
// extract the correct root
|
// extract the correct root
|
||||||
|
|
||||||
specPath := idx.GetSpecAbsolutePath()
|
specPath := idx.GetSpecAbsolutePath()
|
||||||
if ctx.Value(index.CurrentPathKey) != nil {
|
if ctx.Value(index.CurrentPathKey) != nil {
|
||||||
specPath = ctx.Value(index.CurrentPathKey).(string)
|
specPath = ctx.Value(index.CurrentPathKey).(string)
|
||||||
|
|||||||
@@ -314,7 +314,9 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) {
|
|||||||
}
|
}
|
||||||
return nil, clientErr
|
return nil, clientErr
|
||||||
}
|
}
|
||||||
|
if response == nil {
|
||||||
|
return nil, fmt.Errorf("empty response from remote URL: %s", remoteParsedURL.String())
|
||||||
|
}
|
||||||
responseBytes, readError := io.ReadAll(response.Body)
|
responseBytes, readError := io.ReadAll(response.Body)
|
||||||
if readError != nil {
|
if readError != nil {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user