How to use the HttpClient function from aws-sdk

Find comprehensive JavaScript aws-sdk.HttpClient code examples handpicked from public code repositorys.

90
91
92
93
94
95
96
97
98
99

var credentials = new AWS.EnvironmentCredentials('AWS');
var signer = new AWS.Signers.V4(request, 'es');
signer.addAuthorization(credentials, new Date());

var client = new AWS.HttpClient();
client.handleRequest(request, null, function (response) {
  var responseBody = '';
  response.on('data', function (chunk) {
    responseBody += chunk;
fork icon2
star icon4
watch icon0

5
6
7
8
9
10
11
12
13
14
  endpoint: 'https://s3.ianm1837.com',
  s3ForcePathStyle: true,
  signatureVersion: 'v4',
});


s3.client = new AWS.HttpClient();


module.exports = s3;
fork icon3
star icon1
watch icon0

31
32
33
34
35
36
37
38
39
40
// const signer = new AWS.Signers.V4(request, 'es');
// signer.addAuthorization(credentials, new Date());

console.log('REQUEST, YO : ', request);

let client = new AWS.HttpClient();
client.handleRequest(request, null, (response) => {
	let responseBody = '';
	response.on('data', (chunk) => {
		responseBody += chunk;
fork icon0
star icon1
watch icon0

62
63
64
65
66
67
68
69
70
71

const credentials = new AWS.EnvironmentCredentials('AWS');
const signer = new AWS.Signers.V4(aws_request, 'es');
signer.addAuthorization(credentials, new Date());

const client = new AWS.HttpClient();
response = await new Promise((resolve, reject) => {
  client.handleRequest(
    aws_request,
    null,
fork icon1
star icon0
watch icon0

40
41
42
43
44
45
46
47
48
49
// body, but including it for all requests doesn't seem to hurt anything.
request.headers['Content-Length'] = Buffer.byteLength(request.body)

signRequest(request)

const client = new AWS.HttpClient()

return new Promise((resolve, reject) => {
  client.handleRequest(request, null, function (response) {
    // console.log(response.statusCode + ' ' + response.statusMessage)
fork icon0
star icon0
watch icon0

+ 9 other calls in file

13
14
15
16
17
18
19
20
21
22
23
24
const personnelUtil = require('./model/personnel');


const AWS = require('aws-sdk');
const { AWS_REGION, ELASTICSEARCH_DOMAIN } = process.env;
const endpoint = new AWS.Endpoint(ELASTICSEARCH_DOMAIN || "http://localhost");
const httpClient = new AWS.HttpClient();
const credentials = new AWS.EnvironmentCredentials('AWS');


const log = util.log;

fork icon0
star icon0
watch icon0

65
66
67
68
69
70
71
72
73
74
if(indexType=="SavedSearch")
    req = buildESRequest('POST', path.join('/', esDomainSavedSearch.index, esDomainSavedSearch.doctype, id), doc);
else
    req = buildESRequest('POST', path.join('/', esDomainVehicle.index, esDomainVehicle.doctype, id), doc);

var send = new AWS.HttpClient();

send.handleRequest(req, null, function (httpResp) {

    var respBody = '';
fork icon0
star icon0
watch icon0