BREAKING CHANGE(core): major architectural refactoring with cross-platform support and SmartRequest rename
Some checks failed
Default (tags) / security (push) Failing after 24s
Default (tags) / test (push) Failing after 12s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped

This commit is contained in:
2025-07-28 23:20:52 +00:00
parent 8e75047d1f
commit 2dc82bd730
10 changed files with 2019 additions and 2545 deletions

View File

@@ -1,9 +1,9 @@
import { tap, expect } from '@pushrocks/tapbundle';
import { tap, expect } from '@git.zone/tstest/tapbundle';
import { SmartRequestClient } from '../ts/client/index.js';
import { SmartRequest } from '../ts/client/index.js';
tap.test('client: should request a html document over https', async () => {
const response = await SmartRequestClient.create()
const response = await SmartRequest.create()
.url('https://encrypted.google.com/')
.get();
@@ -15,7 +15,7 @@ tap.test('client: should request a html document over https', async () => {
});
tap.test('client: should request a JSON document over https', async () => {
const response = await SmartRequestClient.create()
const response = await SmartRequest.create()
.url('https://jsonplaceholder.typicode.com/posts/1')
.get();
@@ -26,7 +26,7 @@ tap.test('client: should request a JSON document over https', async () => {
tap.test('client: should post a JSON document over http', async () => {
const testData = { text: 'example_text' };
const response = await SmartRequestClient.create()
const response = await SmartRequest.create()
.url('https://httpbin.org/post')
.json(testData)
.post();
@@ -41,7 +41,7 @@ tap.test('client: should set headers correctly', async () => {
const customHeader = 'X-Custom-Header';
const headerValue = 'test-value';
const response = await SmartRequestClient.create()
const response = await SmartRequest.create()
.url('https://httpbin.org/headers')
.header(customHeader, headerValue)
.get();
@@ -57,7 +57,7 @@ tap.test('client: should set headers correctly', async () => {
tap.test('client: should handle query parameters', async () => {
const params = { param1: 'value1', param2: 'value2' };
const response = await SmartRequestClient.create()
const response = await SmartRequest.create()
.url('https://httpbin.org/get')
.query(params)
.get();
@@ -72,7 +72,7 @@ tap.test('client: should handle query parameters', async () => {
tap.test('client: should handle timeout configuration', async () => {
// This test just verifies that the timeout method doesn't throw
const client = SmartRequestClient.create()
const client = SmartRequest.create()
.url('https://httpbin.org/get')
.timeout(5000);
@@ -83,7 +83,7 @@ tap.test('client: should handle timeout configuration', async () => {
tap.test('client: should handle retry configuration', async () => {
// This test just verifies that the retry method doesn't throw
const client = SmartRequestClient.create()
const client = SmartRequest.create()
.url('https://httpbin.org/get')
.retry(1);