Skip to content

doc(http_profile): fix broken code examples in header setter docs - #1954

Open
meliharik wants to merge 1 commit into
dart-lang:masterfrom
meliharik:docs-fix-http-profile-examples
Open

doc(http_profile): fix broken code examples in header setter docs#1954
meliharik wants to merge 1 commit into
dart-lang:masterfrom
meliharik:docs-fix-http-profile-examples

Conversation

@meliharik

Copy link
Copy Markdown

The four header-setter doc comments in package:http_profile contain examples that don't compile, plus one wrong receiver. All verified against the package's own tests, which use the correct form.

Wrong receiver in the response class

http_profile_response_data.dart:98 documented HttpProfileResponseData.headersListValues with profile?.requestData... — copied from the request file. Now responseData.

Setters invoked with call syntax

All four examples called the setters like methods:

profile?.requestData.headersListValues({'Foo': ['Bar', 'Baz']});

headersListValues and headersCommaValues are setters, so this doesn't compile. The package's tests use assignment — http_profile_response_data_test.dart:105:

profile.responseData.headersListValues = {

The examples now match.

Bracket typos

  • {'Foo': 'Bar, Baz']}); (request:120, response:118) — a ] closing a {.
  • The headers getter docs showed the bare map as {'Foo': ['Bar', 'Baz']}); (request:137, response:135) — a stray ); on what the prose describes as just a map.

Each fixed snippet was checked with dart format --output=none: fails to parse before, parses after.

Added a bullet to the existing 0.1.1-wip CHANGELOG section; no version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant