emersion / go-message

✉️ A streaming Go library for the Internet Message Format and mail messages
MIT License
382 stars 111 forks source link

Introduce a new entity func ReadWithOptions. #150

Closed Spiral90210 closed 2 years ago

Spiral90210 commented 2 years ago

This provides a way to customise the behaviour of Read, starting with the max permissible size headers can be. Resolves #149

Spiral90210 commented 2 years ago

I've updated ReadWithOptions to take a value receiver, and changed checkValues() -> withDefaults() which produces a pointer to a new value. There's a test to ensure no mutation of the original options, and much better test coverage of different option scenarios. Thanks for the quick feedback, sorry I didn't get it done last night as I'd said.

emersion commented 2 years ago

It would be nice to allow to pass nil to get all default options.

Spiral90210 commented 2 years ago

It would be nice to allow to pass nil to get all default options.

Even better to not crash 😆 - pushed.

emersion commented 2 years ago

Thanks!