Git Product home page Git Product logo

Comments (3)

dhubler avatar dhubler commented on July 28, 2024

from restconf.

b-kamphorst avatar b-kamphorst commented on July 28, 2024

Thank you for your quick response! Your suggestions do cause me to get another error.

If I do NOT define "message" in the startup file, I get the following for a PUT request:

client

$ curl -X PUT -d '{"hello:message": "R29vZGJ5ZSwgd29ybGQh"}' http://localhost:8080/restconf/data/hello:
curl: (52) Empty reply from server

server

Starting server...
Serving. Press Ctrl+C to exit.
2024/04/11 15:46:06 http: panic serving 127.0.0.1:46410: runtime error: invalid memory address or nil pointer dereference
goroutine 28 [running]:
net/http.(*conn).serve.func1()
        /opt/hostedtoolcache/go/1.20.10/x64/src/net/http/server.go:1854 +0xbf
panic({0xa213a0, 0xff7530})
        /opt/hostedtoolcache/go/1.20.10/x64/src/runtime/panic.go:890 +0x263
github.com/freeconf/yang/node.(*Selection).Delete(0xc0005773b0)
        /home/runner/go/pkg/mod/github.com/freeconf/[email protected]/node/selection.go:400 +0x20d
github.com/freeconf/yang/node.(*Selection).ReplaceFrom(0xc000366700?, {0xbe7038, 0xc0001523f0})
        /home/runner/go/pkg/mod/github.com/freeconf/[email protected]/node/selection.go:469 +0x2c
github.com/freeconf/restconf.(*browserHandler).ServeHTTP(0xc0000141f0, {0x1, 0x1, 0x1, 0x1, 0x1}, {0xbe2c80?, 0xc00056ee70?}, {0xbe1ee0, 0xc0003541c0}, ...)
        /home/runner/go/pkg/mod/github.com/freeconf/[email protected]/browser_handler.go:175 +0xcd8
github.com/freeconf/restconf.(*Server).serve(0xc00003a725?, {0x1, 0x1, 0x1, 0x1, 0x1}, {0xbe2c80, 0xc00056ee70}, {0xbe3770, 0xc0002ba8d0}, ...)
        /home/runner/go/pkg/mod/github.com/freeconf/[email protected]/server.go:243 +0x125
github.com/freeconf/restconf.(*Server).ServeHTTP(0xc0002b4500, {0xbe1ee0, 0xc0003541c0}, 0xc000366700)
        /home/runner/go/pkg/mod/github.com/freeconf/[email protected]/server.go:185 +0xb6c
net/http.serverHandler.ServeHTTP({0xbe08b0?}, {0xbe1ee0, 0xc0003541c0}, 0xc000366700)
        /opt/hostedtoolcache/go/1.20.10/x64/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc0001c8fc0, {0xbe2c80, 0xc000584060})
        /opt/hostedtoolcache/go/1.20.10/x64/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
        /opt/hostedtoolcache/go/1.20.10/x64/src/net/http/server.go:3089 +0x5ed

A PATCH request works much better:

client

curl -X PATCH -d '{"hello:message": "R29vZGJ5ZSwgd29ybGQh"}' http://localhost:8080/restconf/data/hello:
cannot coerse 'string' to binary value

No terminal output on server side. So this seems to be the correct request, apart from the fact that the string is not decoded with base64.

On the other hand, if I define "message": "SGVsbG8sIHdvcmxkIQ==" in the startup file then I get the same "cannot coerse 'string' to binary value" as before on server side.

To me it looks like an issue in the base64 JSON string to binary parsing (invocation / logic / ...)? The inputs should be valid base64.

from restconf.

b-kamphorst avatar b-kamphorst commented on July 28, 2024

Note: I just tried the Go implementation, and everything seems to work fine there.

from restconf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.