diff --git a/packages/horizon-request/examples/interceptor/interceptorTest.html b/packages/horizon-request/examples/interceptor/interceptorTest.html index 00452c7b..0fea5dac 100644 --- a/packages/horizon-request/examples/interceptor/interceptorTest.html +++ b/packages/horizon-request/examples/interceptor/interceptorTest.html @@ -53,21 +53,21 @@ - \ No newline at end of file + diff --git a/packages/horizon-request/examples/request/requestTest.html b/packages/horizon-request/examples/request/requestTest.html index 00bfb70b..7bcfee1f 100644 --- a/packages/horizon-request/examples/request/requestTest.html +++ b/packages/horizon-request/examples/request/requestTest.html @@ -85,8 +85,8 @@ const resetButton = document.getElementById('resetButton'); queryButton.addEventListener('click', function () { - const hrInstance = horizonRequest.create(); - hrInstance.request('http://localhost:3001/', {method: 'GET', data: {}}) + const inulaRequest = inulaRequest.create(); + inulaRequest.request('http://localhost:3001/', {method: 'GET', data: {}}) .then(function (response) { requestResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -94,7 +94,7 @@ requestResult.innerHTML = JSON.stringify(error, null, 2); }) - horizonRequest.default.get('http://localhost:3001/') + inulaRequest.default.get('http://localhost:3001/') .then(function (response) { getResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -102,7 +102,7 @@ getResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest('http://localhost:3001/', {method:'POST', name: 'Alice'}) + inulaRequest('http://localhost:3001/', {method:'POST', name: 'Alice'}) .then(function (response) { postResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -110,7 +110,7 @@ postResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.put('http://localhost:3001/users', {id: 1, name: 'Bob'}) + inulaRequest.put('http://localhost:3001/users', {id: 1, name: 'Bob'}) .then(function (response) { putResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -118,7 +118,7 @@ putResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.delete('http://localhost:3001/users', {params: {id: 1}}) + inulaRequest.delete('http://localhost:3001/users', {params: {id: 1}}) .then(function (response) { deleteResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -126,7 +126,7 @@ deleteResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.head('http://localhost:3001/') + inulaRequest.head('http://localhost:3001/') .then(function (response) { headResult.innerHTML = 'Header: ' + JSON.stringify(response.headers['x-powered-by'], null, 2); // IE 浏览器不支持 HEAD 方式访问响应头 }) @@ -134,7 +134,7 @@ headResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.options('http://localhost:3001/', { + inulaRequest.options('http://localhost:3001/', { headers: { 'Access-Control-Request-Method': 'POST' } @@ -146,7 +146,7 @@ optionsResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.patch('http://localhost:3001/', {name: 'HR'}) + inulaRequest.patch('http://localhost:3001/', {name: 'IR'}) .then(function (response) { patchResult.innerHTML = JSON.stringify(response.data, null, 2); }) @@ -154,7 +154,7 @@ patchResult.innerHTML = JSON.stringify(error, null, 2); }); - horizonRequest.get('http://localhost:3001/download', { + inulaRequest.get('http://localhost:3001/download', { responseType: 'text', onDownloadProgress: function (progressEvent) { const loaded = progressEvent.loaded; diff --git a/packages/horizon-request/examples/server/serverTest.mjs b/packages/horizon-request/examples/server/serverTest.mjs index b09bd2ac..307dd671 100644 --- a/packages/horizon-request/examples/server/serverTest.mjs +++ b/packages/horizon-request/examples/server/serverTest.mjs @@ -13,7 +13,7 @@ app.use(bodyParser.urlencoded({ extended: true })); const corsOptions = { origin: '*', methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], - allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'X-Requested-With,content-type', 'HR-Custom-Header'], + allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'X-Requested-With,content-type', 'IR-Custom-Header'], exposedHeaders: ['X-Powered-By'], optionsSuccessStatus: 200, // 设置 OPTIONS 请求成功时的状态码为 200 credentials: true diff --git a/packages/horizon-request/examples/useHR/App .jsx b/packages/horizon-request/examples/useHR/App .jsx index 60d648aa..4f8df45f 100644 --- a/packages/horizon-request/examples/useHR/App .jsx +++ b/packages/horizon-request/examples/useHR/App .jsx @@ -1,5 +1,5 @@ import Horizon, { useState } from '@cloudsop/horizon'; -import { useHR } from '../../index'; +import { useIR } from '../../index'; const App = () => { @@ -10,7 +10,7 @@ const App = () => { enablePollingOptimization: true, limitation: {minInterval: 500, maxInterval: 4000} }; - const {data} = useHR('http://localhost:3001/', null, options); + const {data} = useIR('http://localhost:3001/', null, options); const handleClick = () => { setSend(true); @@ -18,7 +18,7 @@ const App = () => { return ( <> -
useHR Test
+
useIR Test

{options ? `实时数据流已激活\n更新间隔:${options?.pollingInterval} ms` diff --git a/packages/horizon-request/examples/useHR/index.html b/packages/horizon-request/examples/useHR/index.html index 241d7ea7..8798df30 100644 --- a/packages/horizon-request/examples/useHR/index.html +++ b/packages/horizon-request/examples/useHR/index.html @@ -2,7 +2,7 @@ - useHR Test + useIR Test