diff --git a/snippets_archive/httpDelete.md b/snippets/httpDelete.md similarity index 83% rename from snippets_archive/httpDelete.md rename to snippets/httpDelete.md index 5552a25ae..7fafa8093 100644 --- a/snippets_archive/httpDelete.md +++ b/snippets/httpDelete.md @@ -1,6 +1,6 @@ --- title: httpDelete -tags: browser,intermediate +tags: utility,url,browser,intermediate --- Makes a `DELETE` request to the passed URL. @@ -21,7 +21,9 @@ const httpDelete = (url, callback, err = console.error) => { ``` ```js -httpDelete('https://website.com/users/123', request => { +httpDelete('https://jsonplaceholder.typicode.com/posts/1', request => { console.log(request.responseText); -}); // 'Deletes a user from the database' -``` \ No newline at end of file +}); /* +Logs: {} +*/ +``` diff --git a/snippets_archive/httpPut.md b/snippets/httpPut.md similarity index 75% rename from snippets_archive/httpPut.md rename to snippets/httpPut.md index 14488f79d..d7bf03172 100644 --- a/snippets_archive/httpPut.md +++ b/snippets/httpPut.md @@ -1,6 +1,6 @@ --- title: httpPut -tags: browser,intermediate +tags: utility,url,browser,intermediate --- Makes a `PUT` request to the passed URL. @@ -24,8 +24,20 @@ const httpPut = (url, data, callback, err = console.error) => { ```js const password = "fooBaz"; -const data = JSON.stringify(password); -httpPut('https://website.com/users/123', data, request => { +const data = JSON.stringify({ + id: 1, + title: 'foo', + body: 'bar', + userId: 1 +}); +httpPut('https://jsonplaceholder.typicode.com/posts/1', data, request => { console.log(request.responseText); -}); // 'Updates a user's password in database' -``` \ No newline at end of file +}); /* +Logs: { + id: 1, + title: 'foo', + body: 'bar', + userId: 1 +} +*/ +```