VolleyError UnsupportedOperationException

Posted on
  • Hello, I've been trying to implement a simple app to access some data behind authorization and update it.

    I managed to get a simple HTTP request to work, but as soon as i add the Authorization header, I only get an UnsupportedOperationException back from GadgedBridge.

    Maybe this is a bug in the app?
    I attached my code with the url and token substituted:

    Bangle.http("https://example.com/ID", {timeout: 5000, headers:{
    Authorization: "TOKEN"}}).then(data=>{
      // Do stuff
    }).catch(err=>{
      E.showMessage(err);
    });
    

    P.S. I noticed in the code for the app that there's no case to handle a PATCH http request. That might still be missing as well.

  • I just found a commit of @Gordon which adds the functionality of headers and post requests https://github.com/gfwilliams/Gadgetbrid­ge/commit/4cd53fa9b64fa668960e27b03fed07­edb7237240 . So it looks like it will be possible in the future, when the new release is published.

  • I tried the new version (0.70.01) and i get still the UnsupportedOperationException if i try to add an Authorization Header.

  • Hmm, that's an odd one. But does it work for other header types?

  • I tried it with the headers "Authorization", "authorization" and "test" and i got always the UnsupportedOperationException.
    Here a code to test it. You maybe need to create the endpoit, for that go to the page "https://ptsv2.com" and there you can create you a new endpoint.

    const http = require('http');
    
    setWatch(() => {
      E.showMessage('Start sending');
      Bangle.http(`https://ptsv2.com/t/bangleD­ump/post`, {
        headers: {test: 'Basic dGVzdDp0ZXN0'},
        method: 'POST',
        body: JSON.stringify({test: 1}, null, 2)
      }).then((response) => JSON.parse(response.resp)).catch((err) => {
        E.showMessage('fail ' + JSON.stringify(err));
        return Promise.reject(err);
      }).then((res) => {
        E.showMessage('Send Success');
      });
    }, BTN1, {repeat: true, edge: "falling"});
    
    
    
  • @ReiScarlett do you have still the issue or is it just me?

  • It worked for me with other headers.
    The main issue for me is with the Authorization header and that the PATCH method isn't implemented in Gadgetbridge

  • Hm interesting, which header do you use?

  • To test it out i simply spelled the authorization header differently. The webapp didn't take it of course, but it sent out.

  • Ok, thanks. I think I just fixed this with https://codeberg.org/Freeyourgadget/Gadg­etbridge/pulls/2908 - at least your code above runs fine now

    When it's merged you can try a 'nightly' Gadgetbridge build with it in

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

VolleyError UnsupportedOperationException

Posted by Avatar for ReiScarlett @ReiScarlett

Actions