Added tests for is_valid_origin
Fixed import
Added helper to determine request type.