Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to encode some data, which we need to use in consecutive requests #675

Open
warademilind opened this issue Aug 23, 2024 · 1 comment

Comments

@warademilind
Copy link

warademilind commented Aug 23, 2024

Please find below attached json requests.
here,

${$.POST_QUESTIONS.response.body.id}  is #37:29 every-time its different.
How we can encode like %2337%3A1529
 we need to send that encoded data in next URL. how to do it in Zerocode.
ex.  String input ="#37:29";        
String encoded = URLEncoder.encode(input,"UTF-8");         
System.out.println(encoded);
// Output: %2337%3A1529
{
	"scenarioName": "POST_QUESTION",
	"ignoreStepFailures": true,
	"steps": [
		{
			"name": "POST_QUESTIONS",
			"url": "/questions",
			"operation": "POST",
			"request": {
				"headers": {
					"Authorization": "Bearer ${bearertoken}"
				},
				"body": {
					"question": "zerocode"
				}
			},
			"assertions": {
				"status": 201,
				"body": {
					"id": "${$.POST_QUESTIONS.response.body.id}"
				}
			}
		},
		{
			"name": "GET_QUESTIONS",
			"url": "/questions",
			"operation": "GET",
			"request": {
				"headers": {
					"Authorization": "Bearer ${bearertoken}"
				}
			},
			"assertions": {
				"status": 200
			}
		},
		{
			"name": "UPDATE_QUESTION",
			"url": "/questions/${$.POST_QUESTIONS.response.body.id}",
			"operation": "PUT",
			"request": {
				"headers": {
					"Authorization": "Bearer ${bearertoken}"
				},
				"body": {
					"id": "#43:118",
					"question": "Zerocode Question 123"
				}
			},
			"assertions": {
				"status": 200
			}
		},
		{
			"name": "DELETE_QUESTION",
			"url": "/questions/${$.POST_QUESTIONS.response.body.id}",
			"operation": "DELETE",
			"request": {
				"headers": {
					"Authorization": "Bearer ${beareretoken}"
				}
			},
			"assertions": {
				"status": 204
			}
		}
	]
}


@warademilind
Copy link
Author

warademilind commented Aug 23, 2024

@authorjapps, @santhoshTpixler please do needful help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant