Comments (8)
Thanks for letting me know! I'll have a look at your pull request.
from arest.
I ran into this too.
from arest.
I just tested that, it works just fine. I tried:
http://10.0.1.130/text?params=hallo
And the returned parameters is 'hallo'. Can you give more details like which hardware you are using? And also which Arduino IDE version? This way I can try to isolate the issue. Thanks!
from arest.
I'm running a Freetronics TwentyTen, which is Arduino Duemilanove compatible. I'm using a standard WizNet Ethernet 5100 shield and version 1.6.4 of the Arduino IDE (which is stable).
Here's a minimal example that shows the bug:
#include <SPI.h>
#include <Ethernet.h>
#include <aREST.h>
byte mac[] = { 0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF };
IPAddress ip(192,168,2,2);
EthernetServer server(80);
aREST rest = aREST();
void setup(void) {
Serial.begin(9600);
rest.set_id("001");
rest.set_name("test");
rest.function("print", printHandler);
// Start the Ethernet connection and the server
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
}
server.begin();
Serial.print("Server: ");
Serial.println(Ethernet.localIP());
}
void loop() {
EthernetClient client = server.available();
rest.handle(client);
}
int printHandler(String command) {
Serial.println("Message received:");
Serial.println(command);
return 0;
}
Here are some tests I ran using curl 7.42.0
.
Here's the trailing HTTP/
:
$ curl http://192.168.1.14/print?params=hello
{"return_value": 0, "id": "001", "name": "test", "connected": true}
Message received:
hello HTTP/
It seems that aRest just slices from the 7th character.
$ curl http://192.168.1.14/print?1234567
{"return_value": 0, "id": "001", "name": "test", "connected": true}
Message received:
HTTP/
It's possible to get an entirely empty message by providing only 1 character in the query string:
$ curl http://192.168.1.14/print?1
{"return_value": 0, "id": "001", "name": "test", "connected": true}
Message received:
from arest.
Got it now ! It's just because according to the aREST documentation, you need to use ?params= before giving the arguments :) From the doc:
/led?params=0 executes the function
So you would need to do:
curl http://192.168.1.14/print?params=1234567
from arest.
@marcoschwartz: It's more than that, note the trailing HTTP/
in my first example. Also, requiring the string to be called params but not checking that strikes me as somewhat fragile (which is what my latter examples demonstrate).
from arest.
Hello,
I just tried again with my UNO + Ethernet shield, couldn't reproduce the trailing HTTP error. Can you try with the latest revision of the library ?
from arest.
This is now fixed :)
from arest.
Related Issues (20)
- arest.io problem HOT 3
- output pin set to low at startup
- Issue with multiple Custom functions
- Unable to create a new account HOT 2
- Request example sketch for local use of API key HOT 1
- function name gets confused after 6 characters HOT 1
- 'class aREST' has no member named 'get_topic' HOT 3
- Limitations HOT 1
- ethernet_cloud sketch don't run HOT 2
- https://dashboard.arest.io/devices is not providing any way to add devices HOT 1
- Why is support for text and float variables restricted?
- aREST using UIPEthernet stack failed HOT 1
- Multiple warnings ISO C++ forbids converting a string constant to 'char*' [-Write-strings]
- To support Ethernet2.h library, this should be "ethernet_h"
- Does aREST support the Arduino Uno WiFi r2 Board ? HOT 4
- ESP8266WiFi.h: No such file or directory compilation terminated.
- rest.function() bug: command is improperly passed to function
- How to force send a HTTP 200 command in a rest.function
- CONTROLLINO MAXI AUTOMATION WITH AREST
- Freezes
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 arest.