File tree Expand file tree Collapse file tree 6 files changed +30
-25
lines changed
Expand file tree Collapse file tree 6 files changed +30
-25
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11+ name : build-${{ matrix.deno-version == 'nightly' && 'nightly' || 'release' }}-${{ matrix.unstable && 'unstable' || 'stable' }}-${{ matrix.no-check && 'nocheck' || 'tsc' }}
1112 runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ deno-version : [v1.4.0, nightly]
16+ unstable : [false, true]
17+ no-check : [false, true]
1218 env :
1319 AWS_ACCESS_KEY_ID : AKIAIOSFODNN7EXAMPLE
1420 AWS_SECRET_ACCESS_KEY : wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
1521 steps :
1622 - name : Setup Deno environment
17- uses : denolib/setup-deno@v1.3 .0
23+ uses : denolib/setup-deno@v2.2 .0
1824 with :
19- deno-version : v1.2.3
25+ deno-version : ${{ matrix.deno-version }}
2026
2127 - uses : actions/checkout@v2
2228
3238 aws --endpoint-url "http://localhost:9324" sqs create-queue --queue-name test --region us-east-1 --attributes VisibilityTimeout=0
3339
3440 - name : Test
35- run : deno test --allow-net --allow-env
41+ run : deno test --allow-net --allow-env${{ matrix.unstable && ' --unstable' || '' }}${{ matrix.no-check && ' --no-check' || '' }}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Amazon SQS for Deno
99## Examples
1010
1111``` ts
12- import { SQSQueue } from " https://deno.land/x/sqs@0.3.2 /mod.ts" ;
12+ import { SQSQueue } from " https://deno.land/x/sqs@0.3.3 /mod.ts" ;
1313
1414// Create a queue using the queue url and credentials
1515const queue = new SQSQueue ({
Original file line number Diff line number Diff line change 1- export { AWSSignerV4 } from "https://raw.githubusercontent.com/lucacasonato/deno-aws-sign-v4/70a9846c3a856525ee4a3f864ce2f4a0465b95a2/src/mod.ts" ;
2- export type { RequestHeaders } from "https://raw.githubusercontent.com/lucacasonato/deno-aws-sign-v4/70a9846c3a856525ee4a3f864ce2f4a0465b95a2/src/types.ts" ;
3- export { sha256 } from "https://denopkg.com/chiefbiiko/sha256@v1.0.2/mod.ts" ;
4- export { default as parseXML } from "https://raw.githubusercontent.com/nekobato/deno-xml-parser/master/index.ts" ;
1+ export { AWSSignerV4 } from "https://deno.land/x/aws_sign_v4@0.1.1/mod.ts" ;
2+ import { createHash } from "https://deno.land/std@0.69.0/hash/mod.ts" ;
3+ export function sha256Hex ( data : string | Uint8Array ) : string {
4+ const hasher = createHash ( "sha256" ) ;
5+ hasher . update ( data ) ;
6+ return hasher . toString ( "hex" ) ;
7+ }
8+ export { default as parseXML } from "https://raw.githubusercontent.com/nekobato/deno-xml-parser/0bc4c2bd2f5fad36d274279978ca57eec57c680c/index.ts" ;
59export { decode as decodeXMLEntities } from "https://deno.land/x/html_entities@v1.0/lib/xml-entities.js" ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { SQSError } from "./error.ts";
88
99interface Document {
1010 declaration : {
11- attributes : { } ;
11+ attributes : Record < string , unknown > ;
1212 } ;
1313 root : Xml | undefined ;
1414}
Original file line number Diff line number Diff line change 1- import { AWSSignerV4 , sha256 } from "../deps.ts" ;
1+ import { AWSSignerV4 , sha256Hex } from "../deps.ts" ;
22import {
33 parseSendMessageResponse ,
44 parseReceiveMessageBody ,
@@ -36,7 +36,7 @@ export class SQSQueue {
3636 this . #queueURL = config . queueURL ;
3737 }
3838
39- private _doRequest (
39+ private async _doRequest (
4040 path : string ,
4141 params : Params ,
4242 method : string ,
@@ -47,23 +47,18 @@ export class SQSQueue {
4747 for ( const key in params ) {
4848 url . searchParams . set ( key , params [ key ] ) ;
4949 }
50- const signedHeaders = this . #signer. sign (
51- "sqs" ,
52- url . toString ( ) ,
53- method ,
50+ const request = new Request ( url . toString ( ) , {
5451 headers,
55- body ,
56- ) ;
57- signedHeaders [ "x-amz-content-sha256" ] = sha256 (
58- body ?? "" ,
59- "utf8" ,
60- "hex" ,
61- ) as string ;
62- return fetch ( url , {
6352 method,
64- headers : signedHeaders ,
6553 body,
6654 } ) ;
55+
56+ const signedRequest = await this . #signer. sign (
57+ "sqs" ,
58+ request ,
59+ ) ;
60+ signedRequest . headers . set ( "x-amz-content-sha256" , sha256Hex ( body ?? "" ) ) ;
61+ return fetch ( signedRequest ) ;
6762 }
6863
6964 async sendMessage (
Original file line number Diff line number Diff line change 11export {
22 assert ,
33 assertEquals ,
4- } from "https://deno.land/std@0.64 .0/testing/asserts.ts" ;
4+ } from "https://deno.land/std@0.69 .0/testing/asserts.ts" ;
You can’t perform that action at this time.
0 commit comments