Skip to content

Commit

Permalink
Parse identifierType on request
Browse files Browse the repository at this point in the history
Signed-off-by: WashingtonKK <[email protected]>
  • Loading branch information
WashingtonKK committed Mar 14, 2024
1 parent f9a3609 commit addb5fd
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions opcua/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import (
)

const (
contentType = "application/json"
serverParam = "server"
namespaceParam = "namespace"
identifierParam = "identifier"
defNamespace = "ns=0" // Standard root namespace
defIdentifier = "i=84" // Standard root identifier
contentType = "application/json"
serverParam = "server"
namespaceParam = "namespace"
identifierParam = "identifier"
identifierTypeParam = "identifierType"
defNamespace = "ns=0" // Standard root namespace
defIdentifier = "i=84" // Standard root identifier
)

// MakeHandler returns a HTTP handler for API endpoints.
Expand Down Expand Up @@ -64,15 +65,21 @@ func decodeBrowse(_ context.Context, r *http.Request) (interface{}, error) {
return nil, errors.Wrap(apiutil.ErrValidation, err)
}

iType, err := apiutil.ReadStringQuery(r, identifierTypeParam, "")
if err != nil {
return nil, errors.Wrap(apiutil.ErrValidation, err)
}

if n == "" || i == "" {
n = defNamespace
i = defIdentifier
}

req := browseReq{
ServerURI: s,
Namespace: n,
Identifier: i,
ServerURI: s,
Namespace: n,
Identifier: i,
IdentifierType: iType,
}

return req, nil
Expand Down

0 comments on commit addb5fd

Please sign in to comment.