Created
March 22, 2018 11:38
-
-
Save karakanb/0209362bbe7437a7f6ef8e8a779a201a to your computer and use it in GitHub Desktop.
A sample JS request exported from Postman, fetching the trending repositories from GitHub API.
This file contains hidden or 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
var data = null; | |
var xhr = new XMLHttpRequest(); | |
xhr.withCredentials = true; | |
xhr.addEventListener("readystatechange", function () { | |
if (this.readyState === 4) { | |
console.log(this.responseText); | |
} | |
}); | |
xhr.open("GET", "https://api.github.com/search/repositories?sort=stars&order=desc&q=created:%3E2018-03-17&page=1&per_page=10"); | |
xhr.setRequestHeader("Cache-Control", "no-cache"); | |
xhr.send(data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment