-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(samples): Samples for v4 Signed URL #654
Conversation
That's a fine lookin API! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more small nit and LGTM.
samples/files.js
Outdated
const options = { | ||
version: 'v4', | ||
action: 'read', | ||
expires: Date.now() + 1000 * 60 * 60, // one hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed this in the last review, please change expires time to 15 minutes to be consistent with other language samples. For Read and Upload samples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few nits, mainly I feel the ratio of console.logs
to the size of the code snippets is a bit high (but maaaaybe I'm too terse). I would, however, try to make your tests less dependent on the text output.
.getSignedUrl(options); | ||
|
||
console.log('Generated GET signed URL:'); | ||
console.log(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a little wordy, I might be tempted to consolidate in a single template string comment:
console.info(`generated the signed URL ${url} which is valid for one hour`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call out, but as @frankyn mentioned, we have standardized the outputs of these samples across languages so we'd just have to follow the canonical :)
samples/system-test/files.test.js
Outdated
`${cmd} generate-v4-upload-signed-url ${bucketName} ${signedFileName}` | ||
); | ||
const regExp = new RegExp( | ||
'Generated PUT signed URL:\n' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again I'd probably try to reduce the size of this regex, perhaps just:
output.match(/URL: ([^ ]+)/)
* feat: v4 signed url WIP * make version an optinoal * lint * add required host header * fix canonical query params joining * add test for defaulting to v2 * fix v4 signing with test * fix tests * refactor post-signing url construction v2/v4 * add v4 tests: response-content-type and generate parameters * convert signature to HEX * add conformance test * npm run fix * remove reduntant toLowerCase * do not promisify getDate() * add system-test for v4 signing * run conformance test along with system test * fix tests * add content-md5 and content-type to signed headers if given * Object.entries in not ES5 * npm run fix * split out conformance test * test: invalid version param given * mock out Date when testing instead of override Date * use Array.map to build canonical query * refactor: use dateformat library instead of writing a function * refactor: remove unused * remove reference to deleted methods * refactor: use string interpolation and dot accessor * refactor: use method chaining * add a comment about singled valued header * refactor signedHeaders * Number(x) * refactor: use query-string module as url.parse is deprecated * npm run fix * use query-string to build canonicalQueryParams * refactor: verb => method * refactor: use sinon.FakeTimers instead of timekeeper * npm run fix * use async/await for new system-test * use async/await for new test (2) * convert getSignedUrl tests to async/await * refactor: correctly filter out undefined header values * npm run fix * make v4 multi-valued header delimiter consistent with v2, (single `,`, no space) * copy stack trace * fix: replace ALL sequential spaces * OutgoingHttpHeaders use generic type .map; rename flattenObject => objectEntries * refactor: use build-in querystring * break up v2/v4 signed url query interface * add comments about the construction of canonical headers * npm run fix * git merge failed to put code in right place * test: assert SigningError thrown * test(v4): resumable upload * prefer string.includes over indexOf * npm run fix * docs: add a note on POST and X-Goog-Resumable * SEVEN_DAYS = 604800 * emit warning when using default version * emitWarning if using default version for signing * restore stub * add new line * test: v4 signed URL: conformance test (#638) * Revert "split out conformance test" This reverts commit ce00255. * sync conformance-test cases; parse cases without modification * this.skip * refactor: lift interface * remove default v2 warning * docs(samples): Samples for v4 Signed URL (#654) * remove timeout on conformance-test * npm run fix
No description provided.