Skip to content
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

expose methods for hex encoded strings #2189

Merged
merged 1 commit into from Feb 17, 2020
Merged

expose methods for hex encoded strings #2189

merged 1 commit into from Feb 17, 2020

Conversation

tanner0101
Copy link
Member

@tanner0101 tanner0101 commented Feb 17, 2020

Exposes methods for generating hex-encoded strings from a collection of bytes (#2189, fixes #2187).

import Vapor

let bytes: [UInt8] = ...
print(bytes.hexEncodedString()) // Hex-encoded w/ lowercase characters
print(bytes.hexEncodedString(uppercase: true)) // Hex-encoded w/ uppercase characters

A concise hex method has also been added to match the similar base64 method which already exists.

print(bytes.hex) // Hex-encoded string (lowercase)

@tanner0101 tanner0101 added the enhancement New feature or request label Feb 17, 2020
@tanner0101 tanner0101 added this to In Progress in Vapor 4 via automation Feb 17, 2020
@tanner0101 tanner0101 added the semver-minor Contains new API label Feb 17, 2020
@tanner0101 tanner0101 merged commit 7bd5d33 into master Feb 17, 2020
Vapor 4 automation moved this from In Progress to Done Feb 17, 2020
@tanner0101 tanner0101 deleted the tn-hex branch February 17, 2020 21:47
@tanner0101 tanner0101 restored the tn-hex branch February 17, 2020 22:16
tanner0101 added a commit that referenced this pull request Feb 17, 2020
@tanner0101 tanner0101 deleted the tn-hex branch February 17, 2020 22:17
mohpor pushed a commit to mohpor/vapor that referenced this pull request Feb 18, 2020
tanner0101 added a commit that referenced this pull request Feb 19, 2020
* Added CaseOf Validation with tests

Signed-off-by: Mohammad <porooshani@gmail.com>

* Changed caseOf to case and improved error messages and updated tests.

Signed-off-by: Mohammad <porooshani@gmail.com>

* Removed non-CaseIterable support from case(of:) validation.

Signed-off-by: Mohammad <porooshani@gmail.com>

* Removed unwanted map in error generator

Signed-off-by: Mohammad <porooshani@gmail.com>

* Improved error Generation.

Signed-off-by: Mohammad <porooshani@gmail.com>

* Add myself as a maintainer (#2188)

* Adds EndpointCache for handling GET resource caching (#2184)

* Adds a generic EndpointCache<T> class

* Review fixups

* Changed internal to private

* Changed internal to private

* Renamed the error

* add EndpointCache tests

* add CacheControl convienience init

* rename badJSON error case

Co-authored-by: Tanner <me@tanner.xyz>

* expose methods for hex encoded strings (#2189)

* Removed non-CaseIterable support from case(of:) validation.

Signed-off-by: Mohammad <porooshani@gmail.com>

* Removed unwanted map in error generator

Signed-off-by: Mohammad <porooshani@gmail.com>

* Improved error Generation.

Signed-off-by: Mohammad <porooshani@gmail.com>

* Improved description message for case(of:)

Signed-off-by: Mohammad <porooshani@gmail.com>

Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
Co-authored-by: grosch <scott.grosch@icloud.com>
Co-authored-by: Tanner <me@tanner.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-minor Contains new API
Projects
Vapor 4
  
Done
Development

Successfully merging this pull request may close these issues.

func hexEncodedString() should be public
1 participant