fix(core): update
This commit is contained in:
		
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							| @@ -46,23 +46,24 @@ let options: smartrequest.ISmartRequestOptions = { // typed options | |||||||
|         "Content-Type": "application/json" |         "Content-Type": "application/json" | ||||||
|         "Authorization": "Bearer token" |         "Authorization": "Bearer token" | ||||||
|     }, |     }, | ||||||
|     requestBody: { |     requestBody: JSON.stringify({ | ||||||
|         key1: 'value1', |         key1: 'value1', | ||||||
|         key2: 3 |         key2: 3 | ||||||
|     } |     }) | ||||||
| } | } | ||||||
|  |  | ||||||
| smartrequest.post('https://example.com', options).then(res => { | smartrequest.request('https://example.com', options).then(res => { | ||||||
|     console.log(res.status) |     console.log(res.status) | ||||||
|     console.log(res.body) // if json, body will be parsed automatically |     console.log(res.body) // if json, body will be parsed automatically | ||||||
| }).catch(err => { | }).catch(err => { | ||||||
|     console.log(err) |     console.log(err) | ||||||
| }) | }) | ||||||
|  |  | ||||||
| // also available | // dedicated JSON metods are available: | ||||||
| smartrequest.get(...) | smartrequest.getJson(...) | ||||||
| smartrequest.put(...) | smartrequest.postJson(...) | ||||||
| smartrequest.del(...) | smartrequest.putJson(...) | ||||||
|  | smartrequest.delJson(...) | ||||||
|  |  | ||||||
| // streaming | // streaming | ||||||
| smartrequest.get('https://example.com/bigfile.mp4', optionsArg, true).then(res => { // third arg = true signals streaming | smartrequest.get('https://example.com/bigfile.mp4', optionsArg, true).then(res => { // third arg = true signals streaming | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user