@divine/headers
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -12,6 +12,7 @@ export interface ContentHeaderParams { | ||
param(name: string, fallback: string): string; | ||
setParam(name: string, value: string | number | undefined): this; | ||
valueOf(): string; | ||
} | ||
export declare class ContentDisposition extends ContentHeader { | ||
constructor(unparsed: string); | ||
constructor(unparsed: string, filename?: string); | ||
get filename(): string | undefined; | ||
@@ -18,0 +19,0 @@ } |
@@ -38,2 +38,11 @@ "use strict"; | ||
} | ||
setParam(name, value) { | ||
if (value !== undefined) { | ||
this.params[name] = String(value); | ||
} | ||
else { | ||
delete this.params[name]; | ||
} | ||
return this; | ||
} | ||
valueOf() { | ||
@@ -54,4 +63,5 @@ let params = ''; | ||
class ContentDisposition extends ContentHeader { | ||
constructor(unparsed) { | ||
constructor(unparsed, filename) { | ||
super(unparsed, 'content-disposition'); | ||
this.setParam('filename', filename); | ||
} | ||
@@ -58,0 +68,0 @@ get filename() { |
{ | ||
"name": "@divine/headers", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "The Divine HTTP Header Library", | ||
@@ -5,0 +5,0 @@ "main": "lib/src/index.js", |
@@ -50,2 +50,13 @@ export interface ContentHeaderParams { | ||
setParam(name: string, value: string | number | undefined): this { | ||
if (value !== undefined) { | ||
this.params[name] = String(value); | ||
} | ||
else { | ||
delete this.params[name]; | ||
} | ||
return this; | ||
} | ||
valueOf(): string { | ||
@@ -71,4 +82,6 @@ let params = ''; | ||
export class ContentDisposition extends ContentHeader { | ||
constructor(unparsed: string) { | ||
constructor(unparsed: string, filename?: string) { | ||
super(unparsed, 'content-disposition'); | ||
this.setParam('filename', filename); | ||
} | ||
@@ -75,0 +88,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12807
203