-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from ba-st/moved-http-client-error
Moved http client error
- Loading branch information
Showing
12 changed files
with
165 additions
and
176 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
104 changes: 104 additions & 0 deletions
104
source/Stargate-MigrationTo2/HTTPClientError.extension.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,104 @@ | ||
Extension { #name : #HTTPClientError } | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalBadRequest: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use badRequest signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalBadRequest: `@message' -> '`@receiver badRequest signal: `@message'. | ||
|
||
^ self signal: 400 describedBy: aFailureExplanation | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalConflict: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use conflict signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalConflict: `@message' -> '`@receiver conflict signal: `@message'. | ||
|
||
^self signal: 409 describedBy: aFailureExplanation | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalNotFound [ | ||
|
||
self | ||
deprecated: 'Use notFound signal instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalNotFound' -> '`@receiver notFound signal'. | ||
|
||
^ self signal: 404 describedBy: 'Not found' | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalNotFound: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use notFound signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalNotFound: `@message' -> '`@receiver notFound signal: `@message'. | ||
|
||
^ self signal: 404 describedBy: aFailureExplanation | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalPreconditionFailed [ | ||
|
||
self | ||
deprecated: 'Use preconditionFailed signal instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalPreconditionFailed' -> '`@receiver preconditionFailed signal'. | ||
|
||
^ self | ||
signal: 428 | ||
describedBy: | ||
'One or more conditions given in the request header fields evaluated to false when tested on the server.' | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalPreconditionRequired: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use preconditionRequired signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: '`@receiver signalPreconditionRequired: `@messageText' -> '`@receiver preconditionRequired signal: `@messageText'. | ||
|
||
^ self signal: 428 describedBy: aFailureExplanation | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalUnprocessableEntity: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use unprocessableEntity signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: | ||
'`@receiver signalUnprocessableEntity: `@message' | ||
-> '`@receiver unprocessableEntity signal: `@message'. | ||
|
||
^ self signal: 422 describedBy: aFailureExplanation | ||
] | ||
|
||
{ #category : #'*Stargate-MigrationTo2' } | ||
HTTPClientError class >> signalUnsupportedMediaType: aFailureExplanation [ | ||
|
||
self | ||
deprecated: 'Use unsupportedMediaType signal: instead' | ||
on: '2019-06-19' | ||
in: #Stargate2 | ||
transformWith: | ||
'`@receiver signalUnsupportedMediaType: `@message' | ||
-> '`@receiver unsupportedMediaType signal: `@message'. | ||
|
||
^ self signal: 415 describedBy: aFailureExplanation | ||
] |
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 @@ | ||
Package { #name : #'Stargate-MigrationTo2' } |
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
source/Stargate-Model-Tests/HTTPNotAcceptableTest.extension.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,16 @@ | ||
Extension { #name : #HTTPNotAcceptableTest } | ||
|
||
{ #category : #'*Stargate-Model-Tests' } | ||
HTTPNotAcceptableTest >> testNotAcceptableAsJSON [ | ||
|
||
| error json | | ||
|
||
error := HTTPNotAcceptable messageText: 'Ouch!' accepting: {'application/xml' asMediaType}. | ||
json := NeoJSONObject fromString: (NeoJSONWriter toStringPretty: error). | ||
|
||
self | ||
assert: json message equals: 'Ouch!'; | ||
assert: json code equals: 406; | ||
assert: json allowedMediaTypes size equals: 1; | ||
assert: json allowedMediaTypes first equals: 'application/xml' | ||
] |
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,10 @@ | ||
Extension { #name : #HTTPClientError } | ||
|
||
{ #category : #'*Stargate-Model' } | ||
HTTPClientError >> neoJsonOn: neoJSONWriter [ | ||
|
||
neoJSONWriter | ||
writeMap: | ||
{(#code -> self code). | ||
(#message -> self messageText)} asDictionary | ||
] |
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,12 @@ | ||
Extension { #name : #HTTPNotAcceptable } | ||
|
||
{ #category : #'*Stargate-Model' } | ||
HTTPNotAcceptable >> neoJsonOn: neoJSONWriter [ | ||
|
||
(neoJSONWriter customMappingFor: ZnMimeType) encoder: [ :mediaType | mediaType asString ]. | ||
neoJSONWriter | ||
writeMap: | ||
{(#code -> self code). | ||
(#message -> self messageText). | ||
(#allowedMediaTypes -> self allowedMediaTypes)} asDictionary | ||
] |
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
Oops, something went wrong.