Skip to content

Global Unirest Configuration Broke Connection Isolation #607

Description

@frankgiordano

Problem description found by a community member:

Something interesting came up while testing the SDK. I have a test class with two tests. One for basic connection and another with SSL connection to execute a simple tso command. When I ran all the tests Basic test runs fine but SSL one fails with 401. But when I run SSL test alone it runs fine.

Root cause:

The SDK uses a global Unirest instance that is shared. Because Unirest.config() is global, your tests are not isolated.
The issue was resolved by introducing a dedicated UnirestInstance for each connection type, allowing HTTP configuration and state to remain isolated and reusable.

BasicConnection
|
+-- UnirestInstance

SslConnection
|
+-- UnirestInstance

Each connection owns its HTTP state.global

Each connection now owns its own HTTP client state rather than sharing a global mutable Unirest instance.
This architectural change was implemented in the 7.0.1 release, eliminating the shared mutable Unirest instance and resolving the test isolation issue.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions