mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 20:44:10 +00:00
be4afdde37
Summary: This PR updates #6851 from srikanthkh, fixing coding conventions and javadoc, and adding a test plan. Added testing functions into the WebSocketExample page of the UIExplorer, including a tiny http server to set a cookie on demand. Instructions included in the UIExplorer app. Closes https://github.com/facebook/react-native/pull/9114 Differential Revision: D4140534 Pulled By: lacker fbshipit-source-id: e020ad0c6d1d3ea09c0c3564c1795b4e1bc4517d
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* The examples provided by Facebook are for non-commercial testing and
|
|
* evaluation purposes only.
|
|
*
|
|
* Facebook reserves all rights not expressly granted.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
|
|
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
/* eslint-env node */
|
|
|
|
console.log(`\
|
|
Test server for WebSocketExample
|
|
|
|
This will set a cookie named "wstest" on the response of any incoming request.
|
|
`);
|
|
|
|
const connect = require('connect');
|
|
const http = require('http');
|
|
|
|
const app = connect();
|
|
|
|
app.use(function(req, res) {
|
|
console.log('received request');
|
|
const cookieOptions = {
|
|
//httpOnly: true, // the cookie is not accessible by the user (javascript,...)
|
|
secure: false, // allow HTTP
|
|
};
|
|
res.cookie('wstest', 'OK', cookieOptions);
|
|
res.end('Cookie has been set!\n');
|
|
});
|
|
|
|
http.createServer(app).listen(5556);
|