Open DeqingSun opened 8 years ago
Hi there, can you explain what you mean by multiple post handler?
If you mean having multiple post endpoints, yes you can add multiple post route handlers, just make sure they have different route path patterns (the default is /post
). You can change it here:
Also, you can set valid content types in the PostRouteSettings .. e.g.
If the upload content type is not included, it will be rejected.
You can also set the upload redirect page here:
I'm not sure of the best return an "upload rejected" style message at the moment ... I think if you set a media type and the upload is incorrect, that will get you close ... but if you want to actually analyze the binary data using ofxLibmagic or something, that may need to be added as a feature.
Thanks for your reply, Yes I'd like to have multiple post endpoints and I'm writing my own version of SimplePostServer.
Is it possible to print in a web response? Like I have a variable and I can see it's value on a web page?
I'm also looking for an example to have multiple endpoints with their own handler.
It's clear you can change the endpoint for one particular PostRouteSettings
, but how can we add multiple endpoints, each with their own handler, but running inside the same HTTP server?
https://github.com/bakercp/ofxHTTP/blob/master/example_basic_server_post/src/ofApp.cpp#L17-L36
There seems to be an addRoute
method for the SimplePostServer
class, but an example for setting multiple routes with their own handlers would be helpful.
https://bakercp.github.io/ofxHTTP/classofx_1_1_h_t_t_p_1_1_simple_post_server.html
Hi,
Is it possible to have multiple post handler with this library? Also I'd like show whether the file is acceptable. Can I have a dynamically generated upload.html?
Thanks