-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
47 lines (45 loc) · 1.1 KB
/
test.js
File metadata and controls
47 lines (45 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const apiUrl =
"https://port-0-busta-lyumntwj5a7765e6.sel4.cloudtype.app/security-login/join";
const userData = {
loginId: "check4732@naver.com",
password: "123",
passwordCheck: "123",
nickname: "newbie",
username: "John Doe",
phoneNumber: "01012345678",
birthDate: "1990-01-01",
gender: "Male",
job: "Developer",
home: "Seoul",
school: "Korea University",
profilePicture: "profile.jpg",
introduction: "Hello World!",
};
fetch(apiUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(userData),
redirect: "follow",
})
.then((response) => {
console.log("Response status:", response.status);
console.log("Response headers:", response.headers);
return response.text();
})
.then((text) => {
console.log("Response body:", text);
try {
return JSON.parse(text);
} catch (e) {
console.log("응답이 JSON 형식이 아닙니다.");
return text;
}
})
.then((data) => {
console.log("처리된 응답 데이터:", data);
})
.catch((error) => {
console.error("오류 발생:", error);
});