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

The httpResponseSerializer needs to find a serializer for a type by searching all the types #544

Conversation

randytarampi
Copy link
Contributor

@randytarampi randytarampi commented Jul 16, 2020

What does this implement/fix? Explain your changes.

And all the opts.serializers too.

Array.prototype.find short circuits on truthy return values of its callback, which means that we only would've ever traversed the array for the first element of types since opts.serializers.map just returns an array of booleans right?

Fix this typo and add a test to cover my use case of wanting to fall back to a default if no preferred serializer is found.

Does this close any currently open issues?

Nothing that I could find from my quick searching. I just needed this for myself right now.

Any relevant logs, error output, etc?

N/A

Any other comments?

None.

Where has this been tested?

Node.js Versions: 12

Middy Versions: 1

AWS SDK Versions: N/A

Todo list

  • Feature/Fix fully implemented
  • Added tests
  • Updated relevant documentation
  • Updated relevant examples

… by searching all the `types`.

And all the `opts.serializers` too.

[`Array.prototype.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) short circuits on truthy return values of its callback, which means that we only would've ever traversed the array for the first element of `types` since `opts.serializers.map` just returns an array of booleans right?

Fix this typo and add a test to cover my use case of wanting to fall back to a default if no preferred serializer is found.
@randytarampi
Copy link
Contributor Author

Hey @willfarrell,

Got an idea of when this'll go out? I'm about to release something into production and don't really want to have to build & cut my own @randytarampi/http-response-serializer if the official fix is coming soon.

@willfarrell
Copy link
Member

Sorry about that. Been working around the clock these days. I'll make time this week to put a release together. expect a v1.1.0

@randytarampi
Copy link
Contributor Author

Thank you very much! 🙏

@willfarrell willfarrell merged commit 689a5c3 into middyjs:master Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants