From addb5fd5c585396dbe9aaf09b9830d18fd1cbf33 Mon Sep 17 00:00:00 2001 From: WashingtonKK Date: Fri, 15 Mar 2024 00:05:03 +0300 Subject: [PATCH] Parse identifierType on request Signed-off-by: WashingtonKK --- opcua/api/transport.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/opcua/api/transport.go b/opcua/api/transport.go index ec9ece461b4..cb24cdc8444 100644 --- a/opcua/api/transport.go +++ b/opcua/api/transport.go @@ -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. @@ -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