How can I add a line break in a POST param value? - paw-app

I'm trying to submit a POST request using "Form Url-Encoded" params. When the value contains empty spaces, PAW encodes with the "+" sigh correctly. But what about line breaks?
How can I put a line break in a parameter value? It's a parameter in the body of the post request.

Try putting in %0D%0A, which is the URL-Encoded representation of the line feed and carriage return characters, wherever you want a line break.

The easiest is probably to add that as a Custom Dynamic Value (right-click and pick from the menu: Extensions > Custom). And just returns a "\n" from JavaScript.
He's how it should be looking like:
The JavaScript code is:
function evaluate(context){
return "\n";
};
That should do the trick.

Related

Wordpress encodes GET parameter

I need to pass base64 encoded string as a GET parameter, yes, I know that's a bad idea, but it is necessary. The problem is that I need it like so:
http://example.com/?data=c29tZXRoaW5nQA==
But it changed the URL to:
http://example.com/?data=c29tZXRoaW5nQA%3D%3D
Is there a way to do it? Adding this parameter via the query_vars filter fixed the URL, but then always returns the blog page not frontpage.
you can urldecode() your parameter, which will turn it back into the normal one, when you get it. –
So
$returnValue = urldecode('c29tZXRoaW5nQA%3D%3D');
Will return
$returnValue = "c29tZXRoaW5nQA==";
In short :
$theImage = urldecode($_GET['data']);
Should give you your disired string

Prevent ? from moving to query parameters

I'm working on some interesting APIs that have a "?" in their path, like so:
/api/?other/stuff/here
However, if I type "?" in the request URL in Paw, it automatically moves my cursor into the query parameter fields. Is there a way to disable this? I'm forced to use postman at the moment to work around this, which is less than ideal.
Nevermind, using %3F instead fixed the issue
As mentioned before, using %3F should work nicely!
Another, more generic way is to use the URL-Encode dynamic value:
Right-click on the field where you want to insert the special character and pick Encoding > URL-Encoding > Encode
A popup opens and you can type your special character (here ?) in the Input field. You should see the preview of the encoded value at the bottom of the popup.
Continue to type the end of the URL after this dynamic value. And you should be good to go!

Search and Replace to Add Carriage Returns

I'm calling a REST end point that is unfortunately very windows reliant and required the body of the return to have '\r\n' instead of the default '\n'. Is there any hooks in PAW that could allow me to write a search and replace before sending a request?
Thanks

Servlet stripping parameter values because of # character

My URL is http://175.24.2.166/download?a=TOP#0;ONE=1;TWO2.
How should I encode the parameter so that when I print the parameter in the Servlet, I get the value in its entirety? Currently when I print the value by using request.getParameter("a") I get the output as TOP instead of TOP#0;ONE=1;TWO2.
You should encode it like this http://175.24.2.166/download?a=TOP%230%3BONE%3D1%3BTWO2 . There are a lot of the encoders in Java, you can try to use URLEncoder or some online encoders for experements
This is known as the "fragment identifier".
as mentioned in wiki
The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document.
the part after the # is info for the client. Put everything your client needs here.
you need to encode your query string.
you can use encodeURIComponent() function in JavaScript encodes a URI component.This function encodes special characters.

not get name after space in asp.net in visual studio

while (reader.Read())
{
sb.Append("<img src=news.gif> </img><a href="+"Doc/"+rdr[1].ToString()+" target=_blank onclick=counterfunction("+rdr[2]+")>"+rdr[0].ToString()+"</a>");
sb.Append("<br/>");
}
/* for example
i want to save image name abhi shek.jpg but these hyperlink only get abhi after space not
get anything pls solve these problem */
That's because you're writing href=foo bar.jpg instead of href='foo bar.jpg'
Just include the ' marks.
URLs have to be properly percent-encoded to conform to RFC3986. Space is not a valid character in the URL path, so it must be encoded.
What that boils down to for you is that you must use HttpServerUtility.UrlEncode every time you write an URL in your response.

Resources