actix-extras icon indicating copy to clipboard operation
actix-extras copied to clipboard

Allow testing created `Cors` instance

Open ctron opened this issue 3 years ago • 0 comments

Creating a Cors middleware requires configuration in some cases. That needs testing.

However, it is pretty hard to test a created Cors instance as it doesn't expose its values.

Expected Behavior

Be able to test a Cors instance for its values.

Current Behavior

Not possible. It is possible to render a debug string of the struct, however as it uses HashSet with RandomStates, instances containing HashSet values can't be tested.

Possible Solution

Have Cors implement PartialEq. Or allow access to the values of its Inner.

Steps to Reproduce (for bugs)

  1. Set up a Cors instance
  2. Try to test it.

Context

Your Environment

  • Rust Version (I.e, output of rustc -V):
  • Actix-* crate(s) Version:

ctron avatar Nov 11 '22 09:11 ctron