This is an automated email from the ASF dual-hosted git repository.

kinow pushed a commit to branch GH-2767-fix-js-warnings
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 6f67866b48903d1093be4e8fdc4c4ba5198ef369
Author: Bruno P. Kinoshita <[email protected]>
AuthorDate: Sat Oct 12 17:01:32 2024 +0200

    GH-2767: Fix possible bug: response.statusCode is int, status is a callable 
(and grammar/typo warnings)
---
 jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js    | 11 ++++++-----
 .../jena-fuseki-ui/tests/unit/services/fuseki.service.spec.js |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js 
b/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js
index a090ec17f4..376dbfe691 100644
--- a/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js
+++ b/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js
@@ -16,6 +16,7 @@
  */
 
 import axios from 'axios'
+// eslint-disable-next-line no-unused-vars
 import qs from 'qs'
 import ServerStatus from '@/model/server.status'
 import { BUS } from '@/events'
@@ -33,7 +34,7 @@ class FusekiService {
   }
 
   /**
-   * Gets the Fuseki URL, only the pathname onward. The protocol, server, 
port, etc,
+   * Gets the Fuseki URL, only the pathname onward. The protocol, server, 
port, etc.,
    * are left to the browser/JS engine & Vue to choose. Previously we were 
passing
    * strings such as `/#/ping$`. But this did not work when the application was
    * deployed on a Tomcat server, for example, where the base URL could be 
something
@@ -142,11 +143,11 @@ class FusekiService {
       })
     } catch (error) {
       if (error.response) {
-        if (error.response.status !== 200) {
-          if (error.response.status === 409) {
+        if (error.response.statusCode !== 200) {
+          if (error.response.statusCode === 409) {
             throw new Error(`failed to create dataset "${datasetName}", 
reason: there is another dataset with the same name`)
           }
-          throw new Error(`failed to create dataset "${datasetName}" with type 
${datasetType}, reason: HTTP status: "${error.response.status}", message: 
${error.response.statusText}`)
+          throw new Error(`failed to create dataset "${datasetName}" with type 
${datasetType}, reason: HTTP status: "${error.response.statusCode}", message: 
${error.response.statusText}`)
         }
       }
       throw error
@@ -184,7 +185,7 @@ class FusekiService {
   /**
    * Get the data endpoint out of a list of server endpoints.
    *
-   * For now we are simply returning the first non-empty, but that
+   * For now, we are simply returning the first non-empty, but that
    * may change at some point.
    *
    * @private
diff --git 
a/jena-fuseki2/jena-fuseki-ui/tests/unit/services/fuseki.service.spec.js 
b/jena-fuseki2/jena-fuseki-ui/tests/unit/services/fuseki.service.spec.js
index 6c392bd8ab..dabbfa7ef0 100644
--- a/jena-fuseki2/jena-fuseki-ui/tests/unit/services/fuseki.service.spec.js
+++ b/jena-fuseki2/jena-fuseki-ui/tests/unit/services/fuseki.service.spec.js
@@ -182,7 +182,7 @@ describe('FusekiService', () => {
     const error = new Error('jena')
     error.response = {
       // not supposed to happen... but...
-      status: 200
+      statusCode: 200
     }
     stub.resolves(Promise.reject(error))
     try {
@@ -198,7 +198,7 @@ describe('FusekiService', () => {
     const stub = sinon.stub(axios, 'post')
     const error = new Error('jena')
     error.response = {
-      status: 409
+      statusCode: 409
     }
     stub.resolves(Promise.reject(error))
     try {
@@ -214,7 +214,7 @@ describe('FusekiService', () => {
     const stub = sinon.stub(axios, 'post')
     const error = new Error('jena')
     error.response = {
-      status: 501,
+      statusCode: 501,
       statusText: 'test'
     }
     stub.resolves(Promise.reject(error))

Reply via email to