Comments (3)
from restconf.
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.
Note: I just tried the Go implementation, and everything seems to work fine there.
from restconf.
Related Issues (20)
- when requesting xml, response is a truncated json response HOT 5
- Feature request: Support XMLparsing HOT 1
- Feature request: Support XML output HOT 7
- ServeHTTP in server is not using Request context HOT 2
- Restconf server automatically opens a HTTP server HOT 1
- Feature request: Improve README HOT 1
- Feature request: Improve reflection support HOT 3
- Feature request: Improve error handling HOT 7
- Yang reference needs bump HOT 1
- Response content type not correctly set after XML pull request merge HOT 1
- local.go:ApplyStartupConfigFile function panics instead of returning an error HOT 2
- Restconf does not set the body in the right format (XML) for errors with a body when the accept in the request is XML HOT 2
- Restconf go.mod does not refer to latest freeconf/yang HOT 1
- Content-Type set in util::handle is overwritten by net/http/server.go HOT 1
- Response body for errors not valid in XML HOT 1
- Edit a leaf with `config false` HOT 2
- Bug in support for RFC 8525 HOT 3
- Question: how to view full config after change HOT 9
- Question: how to re-retrieve server configuration HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restconf.