Skip to content

Updated docs to reflect that Response.change(body: null) will not work #127

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

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

jonasfj
Copy link
Member

@jonasfj jonasfj commented Jan 6, 2020

Passing null into Response.change(body: null) does not create a new Response with no body as the documentation would have one think.

Passing an empty list should create the same result as passing null.

I did consider fixing the code as follows, but I think that might be a bit too fancy :)

  @override
  Response change({
    Map<String, String> headers,
    Map<String, Object> context,
    body = #_notChanged,
  }) {
    headers = updateMap(this.headers, headers);
    context = updateMap(this.context, context);

    if (body == #_notChanged) {
      body = extractBody(this);
    }

    return Response(statusCode, body: body, headers: headers, context: context);
  }

@jonasfj jonasfj requested a review from natebosch January 6, 2020 16:00
@natebosch natebosch merged commit fbc691a into dart-lang:master Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants