Skip to content
Snippets Groups Projects
Closed Parse params into struct using Scan() before json.Unmarshal(), where possible.
  • View options
  • Parse params into struct using Scan() before json.Unmarshal(), where possible.

    • View options
  • Closed created by Pieter van Staden

    Before this, json.Unmarshal() was used to scan param values into structs. Now where possible, Scan will be tried first because it does not required quotes in some cases and some cases not

    E.g. when you pass in GET /test?a=1&b=2

    And the params for A is a string and B is an int, the parser tries to json.Unmarshal with and without quotes to cater for both cases. That works fine, but when a Scan() method is available, we do not have to try both ways and have better chance of success.

    Also changed the JSON order to try unquoted first then quoted, in cases where we still would do that.

    Attributes

    Assignee

    None

    Labels

    None

    Milestone

    None

    Dates

    Start: None

    Due: None

    Time tracking

    No estimate or time spent

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first