UNPKG

984 BHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta http-equiv="X-UA-Compatible" content="ie=edge">
7 <title>HttpClient.js</title>
8</head>
9<body>
10 <script src="./dist/HttpClient.js"></script>
11 <script>
12 var client = new HttpClient({
13 baseURL: 'http://example.com'
14 });
15
16 var request = client.send({
17 method: 'POST',
18 url: '/blog/posts/{postId}',
19 param: {
20 postId: 1
21 },
22 query: {
23 excerpt: 'yes'
24 },
25 headers: {
26 'X-Custom-Header': 'Ok',
27 },
28 body: {
29 form: {
30 name: 'YES'
31 }
32 }
33 }, function (res) {
34 console.log(res);
35 }, function (err) {
36 console.error(err);
37 });
38 </script>
39</body>
40</html>