-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible bug in exposing WoT formats attribute #364
Comments
This is not a bug but not really wanted either. The "TD" is accepted to a certain degree. You can specify some content types in forms and jpeg is not supported. |
Thanks for the quick reply! Okay I thought support for image/jpeg got implemented and merged with #187 ? Regarding the IP, I understand the behavior. |
There only png and svg got incorporated :) |
okay thanks for the info. One last question though. It seems you have already done a beginning in supporting jpeg (see below base64 codec which implements the necessary interface and lists "image/jpeg") Update: It doesn't seem to work with "image/png" either. |
I think generally it should just work fine. We do have running examples on http://plugfest.thingweb.io/ E.g., the counter example has a simple A simple GET on http://plugfest.thingweb.io:8083/counter/properties/redDotImage returns a PNG image (a red dot only) The code for it is here, https://github.com/eclipse/thingweb.node-wot/blob/master/packages/examples/src/scripts/counter.ts The following lines show how it is setup The only obvious difference I see is property vs. action. I did try a simple change (see attached file counter.zip) and for me it works.
|
Okay that's my bad. tested it again and it's because of the npm versions. It's working with the latest version 0.7.4 . I didn't update the dependency and was using the version in the template which is at 0.7.0-SNAPSHOT.3. So before #187 got merged into main |
I was following the starter template. I created my own thing and serving it worked well. You can find it on gist. Except, that the forms attribute of my action has changed. It got changed to some apparently standard forms attribute. The console output was the following:
"actions":{"takePhoto":{"title":"takePhoto","description":"description","input":{"unit":"","type":"string"},"forms":[{"href":"http://192.168.8.128:8080/KWH2/actions/takePhoto","contentType":"application/json","op":["invokeaction"],"htv:methodName":"POST"}],"idempotent":false,"safe":false}},
the contentType of my action got changed from image/jpeg to application/json. I tracked the issue down a bit and figured out it happens when i call
exposedthing.expose()
. More detailed ingetServient().expose(_this)
https://github.com/eclipse/thingweb.node-wot/blob/6854ab79022a7c71ee627a6f77a23e0eaaa9d702/packages/core/src/exposed-thing.ts#L99
At this point the _thing still contains the proper form attribute with the image/jpeg.
But then in Servient.expose() Line 133 you are going to overwrite it.
https://github.com/eclipse/thingweb.node-wot/blob/6854ab79022a7c71ee627a6f77a23e0eaaa9d702/packages/core/src/servient.ts#L115-L137
Is this behavior wanted or is this a bug?
The text was updated successfully, but these errors were encountered: