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

Add additional call functions for core other ops #6

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@cak
Copy link

commented Jun 27, 2019

Fixed calls to core other operations by adding two additional call functions:

  • call_other for text responses
  • call_other_json for JSON responses

Added relevant scan_report.rs to /examples.

cak added some commits Jun 27, 2019

Added call functions for core other ops
Added `call_other` for text responses and `call_other_json` for JSON responses
Added scan report example
Example for saving HTML and JSON reports
@psiinon
Copy link
Member

left a comment

Thanks for this - looks good!

Show resolved Hide resolved src/core.rs Outdated
Show resolved Hide resolved examples/scan_report.rs

cak added some commits Jun 29, 2019

Removed main.rs
Replaced with scan_report.rs example
@cak

This comment has been minimized.

Copy link
Author

commented Jun 29, 2019

Thank you to @psiinon (and ZAP Core Team) for taking over the regeneration of the core.rs file. 🚀

The following changes are required:

  • proxy.pac (proxy_pac) -> call_other
  • rootcert -> call_other
  • setproxy -> call_other
  • xmlreport -> call_other
  • htmlreport -> call_other
  • jsonreport -> call_other_json
  • mdreport -> call_other
  • messageHar (message_har) -> call_other_json
  • messagesHar (messages_har) -> call_other_json
  • messagesHarById (messages_har_by_id) -> call_other_json
  • sendHarRequest (send_har_request) -> call_other_json

Additionally, the function return signatures using call_other will need to be modified to Result<String, ZapApiError> (call_other_json can remain unchanged with Result<Value, ZapApiError>) and

Examples:

pub fn mdreport(service: &ZapService) -> Result<String, ZapApiError> {
    let params = HashMap::new();
    super::call_other(service, "core", "other", "mdreport", params)
}

pub fn message_har(service: &ZapService, id: String) -> Result<Value, ZapApiError> {
    let mut params = HashMap::new();
    params.insert("id".to_string(), id);
    super::call_other_json(service, "core", "other", "messageHar", params)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.