salemdar / ngx-cookie

Implementation of Angular 1.x $cookies service to Angular 2
MIT License
318 stars 68 forks source link

Throw exception for oversized cookies #574

Open win36 opened 1 year ago

win36 commented 1 year ago

Is your feature request related to a problem? Please describe. When dealing with larger objects, putObject() cannot be used, because you need to render and size-check the cookie yourself.

Describe the solution you'd like If a Cookie matching or exceeding 4K is detected when trying to write, an exception should be thrown. To match all use cases, making this behavior a non-default cookie option might be a good idea.

Describe alternatives you've considered So far you can work around this issue by not using putObject() and doing serialization and size checking manually.