1

I have a response in list format from an API.

${list}=[u'e2e', u'e2etest', u'123e2e', u'Cost', u'App', u'Env']

I need to replace this list in another API post body.

list_filter=  set variable   ${list}
apibody: dir(filter: {name: {in_: "list_filter"}})

But when I do that I get an error as

Response status code is not equal 200: 200 != 415(Unsupported Media Type)
detail: "Invalid Content-type (application/json), expected JSON data"
status: "415"
title:  "Unsupported Media Type"
type:   "about:blank"
  1. how to remove u (unicode character from list when I get the response or post response?
  2. How to replace the string list in 2nd body?
Mia
  • 448
  • 8
  • 22
  • It is not clear what you are doing and what is happening. What makes you think you need to "remove u" (i.e. encode the string)? What is `apibody: dir(filter: {name: {in_: "list_filter"}})` supposed to mean? Is that what you mean by _"replace the string list in 2nd body"_? The error you are getting is not related to either of these questions. You seem to be sending this to an HTTP server, but something is wrong with the data and/or the mime type you are sending. – zvone Nov 19 '19 at 18:42
  • How to remove u' (unicode) from a list in robotframework? – Mia Nov 20 '19 at 04:17
  • 1
    @zvone is correct, the error you're getting has no connection with that removal; the server is responding with an error that your request was incorrect (its content type). As for how to remove the 'u' from a list - you don't. Lists don't have the 'u' character before the string members - it is there on the string representation of a list. So work with it as a proper list, don't cast it to string in the first place. – Todor Minakov Nov 20 '19 at 05:38
  • Ok thanks ! I made it work. I used replace string in robot framework and that helped in my task. Thanks for your help!! – Mia Nov 20 '19 at 06:10
  • you can find your answer in this post https://stackoverflow.com/questions/37675941/remove-unicode-character-from-python-when-sending-response-back-to-javascript – forkdbloke Nov 20 '19 at 13:16

0 Answers0