bugGNU Octave - Bugs: bug #56624, webwrite only supports...

 
 

bug #56624: webwrite only supports form-encoded parameters, not user-defined data

Submitted by:  Mike Miller <mtmiller>
Submitted on:  Fri 12 Jul 2019 09:01:22 PM UTC  
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  Kai Torben Ohlhus <siko1056>
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 16 Jul 2019 07:00:34 AM UTC, comment #1: 

Confirmed.  Thanks for observing this case Mike.  Unfortunately, this can't be handled by a simple branch:

if (strcmp (options.MediaType, "application/x-www-form-urlencoded"))
  param = strsplit (varargin{1}, {"=", "&"});
...

The "backend function" `__restful_service__` requires a Nx2 cell array of key-value string pairs.  WIP.

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Fri 12 Jul 2019 09:01:22 PM UTC, original submission:  

Octave's webwrite function only allows data to be POSTed in form-encoded key-value pairs. It can't yet be used to send user-defined data such as a XML or JSON blob.

This example should ideally work

options = weboptions ('MediaType', 'text/plain')
response = webwrite ('http://localhost/post', 'This is a test message', options)

and should be the same as

curl -X POST -H 'Content-Type: text/plain' -d 'This is a test message' 'http://localhost/post'

But it instead tries to parse the 'data' argument into key-value pairs and POST as a form anyway.

This is related to the message in weboptions that the MediaType keyword is not yet implemented. If MediaType is not set, then webwrite seems to be working correctly. This is also a Matlab compatibility issue, but since this function is brand new it's fair to consider it a feature request.

Mike Miller <mtmiller>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-07-16 siko1056 StatusNone => Confirmed
        Assigned toNone => siko1056
    2019-07-12 mtmiller Carbon-CopyRemoved 80942 => -

    Back to the top


    Powered by Savane 3.5