Last active
November 22, 2018 14:27
-
-
Save jorovipe97/f1bede2f4e2e029ac00fc9c4f73b3c48 to your computer and use it in GitHub Desktop.
Test method for tour.telemedellin micrositio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// request generator | |
function create_req(method, url, bodyObj) | |
{ | |
var xmlhttp = new XMLHttpRequest(); | |
xmlhttp.open(method, url); | |
// Gets the parsed data from the request body. Only for the POST/PUT/DELETE methods. | |
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | |
xmlhttp.setRequestHeader('Content-Type', 'text/json; charset=UTF-8'); | |
xmlhttp.onload = function () { | |
console.log(xmlhttp.responseText); | |
}; | |
var body = JSON.stringify(bodyObj); | |
xmlhttp.send(body); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /api/ping/ | |
var body = { | |
firstname: 'Jose', | |
lastname: 'Romualdo', | |
email: '[email protected]', | |
body: 'Hi xd how are you' | |
}; | |
create_req('GET', '/api/ping/', null); | |
// /api/contact/ | |
var body = { | |
firstname: 'Jose', | |
lastname: 'Romualdo', | |
email: '[email protected]', | |
body: 'Hi xd how are you' | |
}; | |
create_req('POST', '/api/contact/', body); | |
// /api/newsletter/ | |
var body = { | |
email: '[email protected]' | |
} | |
create_req('POST', '/api/newsletter/', body); | |
// /api/availability/days/{month}/{year}/ | |
create_req('GET', '/api/availability/days/12/2018/', null); | |
// /api/availability/all/ | |
create_req('GET', '/api/availability/all/', null); | |
// '/api/availability/' | |
var body = { | |
date: (new Date()).toGMTString(), | |
start: (new Date()).toGMTString(), | |
capacity: '10' | |
}; | |
create_req('POST', '/api/availability/', body); | |
create_req('GET', '/api/availability/delete/some_fake_id/', null); | |
// '/api/booking/' | |
// no fields are required | |
var body = { | |
availabilityID: '18111915280014hwm0' | |
}; | |
create_req('POST', '/api/booking/', body); | |
// '/api/user/' | |
var body = { | |
uid: '6969696969', | |
email: '[email protected]' | |
}; | |
create_req('POST', '/api/user/', body); | |
create_req('GET', '/api/user/"18042020190002lcw0"/', null); | |
// The cardcode here is not required | |
create_req('GET', '/api/user/card/SOMECODE/', null); | |
// In the following queries the ID is not important because we only want to know whether the server is responding or not | |
create_req('GET', '/api/user/mail/', null); | |
create_req('GET', '/api/user/mailok/some_user_id/', null); | |
// SURVEY | |
create_req('GET', '/api/user/survey/', null); | |
create_req('GET', '/api/user/surveyok/some_user_id/', null); | |
// ASSIST | |
create_req('GET', '/api/booking/assistusr/', null); | |
create_req('GET', '/api/booking/assistusrok/some_user_id/', null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment