-
-
Notifications
You must be signed in to change notification settings - Fork 474
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
1 parent
a45bc26
commit 141249d
Showing
1 changed file
with
62 additions
and
0 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,62 @@ | ||
/** | ||
* @barba/core/modules/headers | ||
* <br><br> | ||
* ## Manage request Headers. | ||
* | ||
* @module core/modules/headers | ||
* @preferred | ||
*/ | ||
|
||
/***/ | ||
|
||
export class Headers { | ||
private _list: HeaderList = new Map([ | ||
['x-barba', 'yes'], | ||
]); | ||
|
||
/** | ||
* Set a new header | ||
*/ | ||
public set(name: string, value: string): IHeaderData { | ||
this._list.set(name, value); | ||
|
||
return { | ||
name: value | ||
}; | ||
} | ||
|
||
/** | ||
* Get a specific header | ||
*/ | ||
public get(name: string): string { | ||
return this._list.get(name); | ||
} | ||
|
||
/** | ||
* Get all headers | ||
*/ | ||
public all(): HeaderList { | ||
return this._list; | ||
} | ||
|
||
/** | ||
* Check if header exists | ||
*/ | ||
public has(name: string): boolean { | ||
return this._list.has(name); | ||
} | ||
|
||
/** | ||
* Delete a header | ||
*/ | ||
public delete(name: string): boolean { | ||
return this._list.delete(name); | ||
} | ||
|
||
/** | ||
* Clear all headers | ||
*/ | ||
public clear(): void { | ||
return this._list.clear(); | ||
} | ||
} |