-
Notifications
You must be signed in to change notification settings - Fork 23
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
curl customiser #2
Comments
Interesting idea. Can you provide a pull request with an implementation of your idea? |
Well I don't know how to implement it carefully. I wrote my own FormattedCurlLoggingInterceptor#process and delete all required strings by pattern with replaceFirst. It's very dirty solution. |
@blacky0x0 I know it's been a year since you requested this feature. I have just completed it. Does it do what you wanted? There's README.md file in feature/2 branch that explains how to use it. |
Sure, I'll check it and write feedback |
The Yes, that's what I wanted before. It's tidy and looks great. I want to configure |
The idea behind the library is to enable reproducing a certain case that occured. As you have shown with your User-Agent example, by removing certain headers curl-logger would generate curl that generates different requests that trigger in different system responses. That would undermine the original purpose of the library. On the other head, I understand, sometimes we need to modify generated curl to test different variations of the same case. And doing this manually might be tedious. Adding possibility to decide which header to include in curl expression is an easy change but it opens a door for other similar feature requests to remove "--binary-data" parameter, replace "--insecure" parameter with its shorter form "-k", etc. Therefore, I think modifying curl expression should be an option but it should be done by the user of the library more explicitly, so s/he is aware what exactly is modified. Practically, I am thinking of giving more control to the users on constructing curl: RestAssuredConfig config = new CurlLoggingRestAssuredConfigBuilder()
.modifyCurl(curl -> curl.removeHeader("Host").addParameter("-k"))
.build(); This would require significant change in |
…parameters and modify a curl command before printing it.
Updated. Let me know if it does what you wanted. |
Exactly! |
What is about customising?
Enable or disable parameters or headers like:
It will make curl query very short and simple.
The text was updated successfully, but these errors were encountered: