Datasets:

Modalities:
Text
Formats:
json
Languages:
code
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
Asankhaya Sharma
add py and js data
0414e50
raw
history blame
940 Bytes
const baseURL = 'http://localhost:9000/api/users/'export const getUsers = () => { return fetch(baseURL) .then(res => res.json()); };export const getUser = (id) => { return fetch(baseURL + id) .then(res => res.json()) };export const postUser = (payload) => { // BUG: CWE-319: Cleartext Transmission of Sensitive Information// return fetch(baseURL, { method: 'POST', body: JSON.stringify(payload), headers: {'Content-Type': 'application/json'} })// FIXED: .then(res => res.json()) };export const putUser = (id , payload) => { return fetch(baseURL + id, { method: 'PUT', body:JSON.stringify(payload), headers : {'Content-Type': 'application/json'} }) .then(res => res.json()) };export const deleteUser = (id) => { return fetch(baseURL + id, { method: 'DELETE' }) };