Comments (1)
https://visionmedia.github.io/superagent/#-post-put-requests
"SuperAgent formats are extensible, however by default "json" and "form" are supported. To send the data as application/x-www-form-urlencoded simply invoke .type() with "form", where the default is "json". This request will POST the body "name=tj&pet=tobi".
request.post('/user')
.type('form')
.send({ name: 'tj' })
.send({ pet: 'tobi' })
.end(callback)
"
We needed xml2jsParser to parse the xml response into json
const xml2jsParser = require('superagent-xml2jsparser');
https://www.npmjs.com/package/body-parser#bodyparserurlencodedoptions
"bodyParser.urlencoded([options])
Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.
A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body). This object will contain key-value pairs, where the value can be a string or array (when extended is false), or any type (when extended is true).
Options
The urlencoded function takes an optional options object that may contain any of the following keys:
extended
The extended option allows to choose between parsing the URL-encoded data with the querystring library (when false) or the qs library (when true). The "extended" syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded. For more information, please see the qs library.
Defaults to true, but using the default has been deprecated. Please research into the difference between qs and querystring and choose the appropriate setting."
from townhall-sms-alerts.
Related Issues (20)
- set up travis
- write the test for townHall class HOT 1
- Handle multiple events better
- Full testing coverage
- mock firebase for better unit testing HOT 2
- only return senate events if they are within ~50 miles of the person's zip
- Save MessagingResponse() object on req, and only create one per session HOT 1
- save user phone number on req
- create users HOT 3
- listener on database... when a new event is created, looks to see if there are relevant users
- send from the queue, and delete on success HOT 1
- create text-to-send model and add to the queue HOT 1
- create the /broadcast route
- Write tests to cover user.js
- after sending event ask if person is going, and if they are their rep
- format alerts to have 'tomorrow' instead of the date
- increment a counter on town hall ids when a SMS message is successfully sent
- Send test vol recruitment text HOT 5
- Send vol recruitment text to 39 states
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 townhall-sms-alerts.