Skip to content

feat: fix error "invalid request size"#168

Merged
hsluoyz merged 1 commit intocasbin:masterfrom
rg2011:master
Feb 5, 2026
Merged

feat: fix error "invalid request size"#168
hsluoyz merged 1 commit intocasbin:masterfrom
rg2011:master

Conversation

@rg2011
Copy link
Contributor

@rg2011 rg2011 commented Feb 4, 2026

fix: #152

I have been affected by isssue #152 and tracked it down to an initialization error in the model instance. I propose a patch with a regression test for your consideration. Thanks!

@CLAassistant
Copy link

CLAassistant commented Feb 4, 2026

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #152 where creating multiple enforcer instances with different request definitions causes an "invalid request size" error. The root cause was that the Model:new() constructor was incorrectly setting instance properties on the class (self) instead of on the instance (o), causing all Model instances to share the same class-level properties.

Changes:

  • Fixed Model initialization to use instance-level properties instead of class-level properties
  • Added regression test for creating multiple enforcers with distinct request definitions

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/model/Model.lua Fixed Model:new() to properly initialize instance properties (o.model, o.sectionNameMap, etc.) instead of class properties (self.model, self.sectionNameMap, etc.)
tests/main/enforcer_spec.lua Added regression test that creates two enforcers with different request definitions and validates both work independently without interfering with each other

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hsluoyz hsluoyz changed the title fixes issue #152 upstream feat: fix error "invalid request size" Feb 5, 2026
@hsluoyz hsluoyz merged commit 76375a8 into casbin:master Feb 5, 2026
13 of 15 checks passed
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🎉 This PR is included in version 1.46.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: invalid request size

3 participants