Comments (13)
Hi @zygis,
this is a fucking situation. I fixed this problem but I think it's not good. Why?
JSON flag should contain application/json content type. I don't know what to do. I left it so.
I'll update partial.js version in few days. Please download source from GitHub.
Thanks.
from framework.
Route for put
and json
like this:
framework.route("/api", callback, {flags: ["json", "put"], timeout: 10000});
put
request header: Content-Type:application/json
and request body: {"key1":"value1","key2":"value2"}
got NULL when doing post request
from framework.
Hi @sakateka,
thanks ... I fixed it. So:
In new version this works:
framework.route("/api", callback, {flags: ["json"], timeout: 10000});
framework.route("/api", callback, {flags: ["post"], timeout: 10000});
framework.route("/api", callback, {flags: ["json", "put"], timeout: 10000});
IMPORTANT: for "json" flag must exist this condition: content-type must be an application/json.
Thanks!
from framework.
framework.route("/api", post, {flags: ["post"], timeout: 10000});
request body:
key1=value1&key2=value2
response
Server: nginx/1.5.7
Date: Thu, 02 Jan 2014 09:09:34 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: partial.js v1311
Cache-Control: private
Vary: Accept-Encoding
400: Bad Request
flags: ["json"] works as expected.
from framework.
Show me your request headers.
Thanks!
2014/1/2 ®ygimantas [email protected]
framework.route("/api", post, {flags: ["post"], timeout: 10000});
request body:
key1=value1&key2=value2
response
Server: nginx/1.5.7
Date: Thu, 02 Jan 2014 09:09:34 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: partial.js v1311
Cache-Control: private
Vary: Accept-Encoding400: Bad Request
flags: ["json"] works as expected.
Reply to this email directly or view it on GitHubhttps://github.com//issues/52#issuecomment-31442663
.
S pozdravom Peter ©irka
Web Site Design s.r.o.
Web Developer
[email protected]
+421 903 163 302
from framework.
Accept: */*
Cache-Control: no-cache
I found, that POST is working fine with this header:
Content-Type: application/x-www-form-urlencoded
from framework.
You can use "raw" flag ... Then you do not use content-type in the request (but you must parse manually body from controller.post).
Thanks.
from framework.
But how to use "raw" flag?
framework.route("/api", post, ["raw"]);
I got noting with http method POST
POST http://domain.tld/api
Content-Type: application/x-www-form-urlencoded
key1=value1&key2=value2
-- response --
0
from framework.
I found a bug in "raw" flag. I fixed it.
Really sorry.
from framework.
I published new version of partial.js. Please update your version and give me a feedback. IMPORTANT: if you want a RAW data then the request must have a content-type !== application/json.
Thanks!
from framework.
Not working. Same response.
POST http://domain.tld/api
Content-Type: application/x-www-form-urlencoded
key1=value1&key2=value2
-- response --
0
from framework.
Try to add: "post" flag.
Thanks!
2014/1/2 ®ygimantas [email protected]
Not working. Same response.
POST http://domain.tld/api
Content-Type http://domain.tld/apiContent-Type: application/x-www-form-urlencoded
key1=value1&key2=value2-- response --
0Reply to this email directly or view it on GitHubhttps://github.com//issues/52#issuecomment-31462925
.
S pozdravom Peter ©irka
Web Site Design s.r.o.
Web Developer
[email protected]
+421 903 163 302
from framework.
Okay, now I understood. This works fine:
function post () {
// ....
var postData;
if (_.isString(self.post)) {
try {
//noinspection JSValidateTypes
postData = JSON.parse(self.post);
} catch (ignore) {
try {
postData = queryString.parse(self.post);
} catch (ignore) {
postData = {};
}
}
}
// ....
}
framework.route("/api", post, {flags: ["raw", "post"], timeout: 10000});
Thank you for help!
from framework.
Related Issues (20)
- How to ignore U.request() causing self signed certificate in certificate chain error. HOT 3
- [feature] : How to create custom node (component) using python script HOT 4
- Serve Angular components views using TotalJS HOT 3
- How can I validate with schema.define the workflow options? HOT 8
- DBMS PostgreSQL doesn't catch an error HOT 1
- How to store information from a test to reuse it HOT 4
- Please help to fix Bug in REST COMPONENT HOT 6
- How to validate the response schema from unit testing method? HOT 5
- What is substitution for CONFIG method in total.js V4? HOT 4
- AUTH global function is recieving undefined in $.params HOT 4
- Trying to get in touch regarding a security issue HOT 2
- F.snapshotstats is not a function at FrameworkCacheProto.recycle HOT 1
- Total v4 is not sending operation object when using EXEC HOT 5
- How to hide X-Powered-By for security reason? HOT 1
- Timeout Set Up HOT 4
- How to onload in totaljs 4 HOT 2
- How to set CORS for public files? HOT 3
- Exporting the JSON HOT 6
- How to load config file and read config as independent library? HOT 4
- How to custom response 408 timeout on spesific route? HOT 8
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 framework.