Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shortcut for setting authorization header and add basic auth func…
…tionality.
- Loading branch information
1 parent
0b0a5c5
commit d0fb6ff
Showing
7 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copied from https://github.com/HipByte/Flow/blob/44283b31a63bc826d2c068557b6357dc1195680b/flow/base64/android/base64.rb | ||
class Base64 | ||
def self.encode(string) | ||
bytes = Java::Lang::String.new(string).getBytes("UTF-8") | ||
Android::Util::Base64.encodeToString(bytes, Android::Util::Base64::NO_WRAP) | ||
end | ||
|
||
def self.decode(string) | ||
java_string = Java::Lang::String.new(string) | ||
bytes = Android::Util::Base64.decode(java_string, Android::Util::Base64::NO_WRAP) | ||
Java::Lang::String.new(bytes, "UTF-8") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copied from https://github.com/HipByte/Flow/blob/44283b31a63bc826d2c068557b6357dc1195680b/flow/base64/cocoa/base64.rb | ||
class Base64 | ||
def self.encode(string) | ||
data = string.dataUsingEncoding(NSUTF8StringEncoding) | ||
data.base64EncodedStringWithOptions(0) | ||
end | ||
|
||
def self.decode(string) | ||
data = NSData.alloc.initWithBase64EncodedString(string, options: 0) | ||
NSString.alloc.initWithData(data, encoding: NSUTF8StringEncoding) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters