-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
117 additions
and
137 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
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
17 changes: 17 additions & 0 deletions
17
source/Superluminal-Model/HttpRequestHeadersBuilder.class.st
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,17 @@ | ||
Class { | ||
#name : #HttpRequestHeadersBuilder, | ||
#superclass : #Object, | ||
#category : #'Superluminal-Model-Builders' | ||
} | ||
|
||
{ #category : #supplying } | ||
HttpRequestHeadersBuilder >> setAcceptTo: aMediaType [ | ||
|
||
^ SetAcceptMediaTypeCommand to: aMediaType | ||
] | ||
|
||
{ #category : #configuring } | ||
HttpRequestHeadersBuilder >> setBearerTokenTo: anOAuth2AccessToken [ | ||
|
||
^ SetBearerTokenCommand to: anOAuth2AccessToken | ||
] |
17 changes: 0 additions & 17 deletions
17
source/Superluminal-Model/HttpRequestHeadersSupplier.class.st
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
Class { | ||
#name : #SetBearerTokenCommand, | ||
#superclass : #HttpRequestCommand, | ||
#instVars : [ | ||
'token' | ||
], | ||
#category : #'Superluminal-Model-Commands' | ||
} | ||
|
||
{ #category : #'instance creation' } | ||
SetBearerTokenCommand class >> to: anOAuth2AccessToken [ | ||
|
||
^ self new initializeTo: anOAuth2AccessToken | ||
] | ||
|
||
{ #category : #applying } | ||
SetBearerTokenCommand >> applyOn: anHttpClient [ | ||
|
||
anHttpClient headerAt: #Authorization put: ( #'Bearer <1p>' expandMacrosWith: token ) | ||
] | ||
|
||
{ #category : #initialization } | ||
SetBearerTokenCommand >> initializeTo: anOAuth2AccessToken [ | ||
|
||
token := anOAuth2AccessToken | ||
] |
This file was deleted.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
source/Superluminal-Tests/SetBasicAuthenticationCommandTest.class.st
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,17 @@ | ||
Class { | ||
#name : #SetBasicAuthenticationCommandTest, | ||
#superclass : #TestCase, | ||
#category : #'Superluminal-Tests-Commands' | ||
} | ||
|
||
{ #category : #tests } | ||
SetBasicAuthenticationCommandTest >> testApplyOn [ | ||
|
||
| httpClient command | | ||
|
||
httpClient := ZnClient new. | ||
command := SetBasicAuthenticationCommand with: 'user' password: 'password'. | ||
command applyOn: httpClient. | ||
|
||
self assert: ( httpClient request headers at: #Authorization ) equals: 'Basic dXNlcjpwYXNzd29yZA==' | ||
] |
17 changes: 17 additions & 0 deletions
17
source/Superluminal-Tests/SetBearerTokenCommandTest.class.st
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,17 @@ | ||
Class { | ||
#name : #SetBearerTokenCommandTest, | ||
#superclass : #TestCase, | ||
#category : #'Superluminal-Tests-Commands' | ||
} | ||
|
||
{ #category : #tests } | ||
SetBearerTokenCommandTest >> testApplyOn [ | ||
|
||
| httpClient command | | ||
|
||
httpClient := ZnClient new. | ||
command := SetBearerTokenCommand to: 'token'. | ||
command applyOn: httpClient. | ||
|
||
self assert: ( httpClient request headers at: #Authorization ) equals: 'Bearer ''token''' | ||
] |
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
37 changes: 0 additions & 37 deletions
37
source/Superluminal-Tests/SetContentTypeCommandTest.class.st
This file was deleted.
Oops, something went wrong.