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

Adding client tests #95

Merged
merged 2 commits into from
Jun 23, 2017
Merged

Adding client tests #95

merged 2 commits into from
Jun 23, 2017

Conversation

donny-dont
Copy link

@donny-dont donny-dont commented Jun 23, 2017

This adds a dart:html and dart:io compatible Client test. A server is added for the clients to call.

@donny-dont
Copy link
Author

@nex3 this adds the tests but some tests fail.

On the dart:io side

  • Doesn't appear that any bytes are getting transferred over as body is empty when retrieved
  • The content-length header isn't getting set

On the dart:html side

  • The content-length is set automatically by the browser, but it also appends content-length to methods other than GET and HEAD

For both

  • content-type is not getting set.
  • We left out the x-www-form-urlencoded implementation

Anyways I'd like to land this and fix the issues individually.

@kevmoo that means that tests will be failing until the above is resolved.

serverUrl = Uri.parse(await channel.stream.first);
});

// HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These headers seem redundant with the groups.

});

test('readBytes throws an error for a 4** status code', () {
platformClient().readBytes(serverUrl.resolve('/error')).then((_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use async/await.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific way I should be using one of the expect functions? I wasn't able to get it to work otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you figured it out.

@@ -0,0 +1,9 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this is under a "hybrid" directory.

'host',
];

hybridMain(StreamChannel channel) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document this. In particular, mention which tests it's used in and what the server does.

});

test('readBytes throws an error for a 4** status code', () {
platformClient().readBytes(serverUrl.resolve('/error')).then((_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you figured it out.

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