-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return all content in data when no response property is defined (…
…#145) Allow the response type not to be an object since it can also return any type when no `data` is found in the response
- Loading branch information
Showing
5 changed files
with
45 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {AbstractPublicEndpoint} from '@/model'; | ||
|
||
export class TestGet200NoResponseProperty extends AbstractPublicEndpoint { | ||
public readonly name = 'get200NoResponseProperty'; | ||
public readonly path = 'get200NoResponseProperty'; | ||
} |
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,21 @@ | ||
// noinspection JSUnusedGlobalSymbols | ||
|
||
import {defineMockResponse} from '@Test/fetch/defineMockResponse'; | ||
|
||
export default defineMockResponse({ | ||
match: (path: string, init?: RequestInit) => init?.method === 'GET' && path.startsWith('/get200NoResponseProperty'), | ||
|
||
response: () => ({ | ||
headers: {'Content-Type': 'application/json'}, | ||
status: 200, | ||
body: { | ||
data: { | ||
token: 'test', | ||
credentials: { | ||
username: 'test', | ||
password: 'test', | ||
}, | ||
}, | ||
}, | ||
}), | ||
}); |