-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add request parsing related interfaces
- Loading branch information
Showing
6 changed files
with
43 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { AsyncHandler } from '../../util/AsyncHandler'; | ||
import { HttpRequest } from '../../server/HttpRequest'; | ||
import { Representation } from '../representation/Representation'; | ||
|
||
export abstract class BodyParser extends AsyncHandler<HttpRequest, Representation> {} |
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,5 @@ | ||
import { AsyncHandler } from '../../util/AsyncHandler'; | ||
import { HttpRequest } from '../../server/HttpRequest'; | ||
import { RepresentationPreferences } from '../representation/RepresentationPreferences'; | ||
|
||
export abstract class PreferenceParser extends AsyncHandler<HttpRequest, RepresentationPreferences> {} |
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,5 @@ | ||
import { AsyncHandler } from '../../util/AsyncHandler'; | ||
import { HttpRequest } from '../../server/HttpRequest'; | ||
import { ResourceIdentifier } from '../representation/ResourceIdentifier'; | ||
|
||
export abstract class TargetExtractor extends AsyncHandler<HttpRequest, ResourceIdentifier> {} |
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 @@ | ||
/** | ||
* Represents a single preference in a request. | ||
*/ | ||
export interface RepresentationPreference { | ||
/** | ||
* The actual preference value. | ||
*/ | ||
value: string; | ||
/** | ||
* How important this preference is in a value going from 0 to 1. | ||
*/ | ||
weight?: number; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { RepresentationPreference } from './RepresentationPreference'; | ||
|
||
/** | ||
* Contains the preferences of which kind of representation is requested. | ||
*/ | ||
export interface RepresentationPreferences {} | ||
export interface RepresentationPreferences { | ||
type?: RepresentationPreference[]; | ||
charset?: RepresentationPreference[]; | ||
datetime?: RepresentationPreference[]; | ||
encoding?: RepresentationPreference[]; | ||
language?: RepresentationPreference[]; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,9 @@ | ||
/** | ||
* The unique identifier of a resource. | ||
*/ | ||
export interface ResourceIdentifier {} | ||
export interface ResourceIdentifier { | ||
/** | ||
* Path to the relevant resource. Usually this would be an URL. | ||
*/ | ||
path: string; | ||
} |