Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the append method for the Headers API #12467

Merged
merged 4 commits into from Jul 20, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Small changes to Headers.webidl and headers.rs

Expose the Headers interface to the Window scope and to Workers
Move Append function inside HeadersMethods trait
  • Loading branch information
malisas committed Jul 20, 2016
commit 272d12da26f150f9fd6447572dc10464340f3da4
@@ -4,6 +4,7 @@

use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HeadersBinding;
use dom::bindings::codegen::Bindings::HeadersBinding::HeadersMethods;
use dom::bindings::error::Error;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root;
@@ -42,9 +43,11 @@ impl Headers {
pub fn new(global: GlobalRef) -> Root<Headers> {
reflect_dom_object(box Headers::new_inherited(), global, HeadersBinding::Wrap)
}
}

impl HeadersMethods for Headers {
// https://fetch.spec.whatwg.org/#concept-headers-append
pub fn Append(&self, name: ByteString, value: ByteString) -> Result<(), Error> {
fn Append(&self, name: ByteString, value: ByteString) -> Result<(), Error> {
// Step 1
let value = normalize_value(value);

@@ -6,8 +6,8 @@

/* typedef (Headers or sequence<sequence<ByteString>>) HeadersInit; */

/* [Constructor(optional HeadersInit init),
* Exposed=(Window,Worker)] */
/* [Constructor(optional HeadersInit init),*/
[Exposed=(Window,Worker)]

interface Headers {
[Throws]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.