Check response contains a specific key (in nested JSON) */
| 921 | |
| 922 | /* Check response contains a specific key (in nested JSON) */ |
| 923 | static int resp_has_key(const char *resp, const char *key) { |
| 924 | if (!resp) |
| 925 | return 0; |
| 926 | char pattern[64]; |
| 927 | snprintf(pattern, sizeof(pattern), "\"%s\"", key); |
| 928 | if (strstr(resp, pattern) != NULL) |
| 929 | return 1; |
| 930 | snprintf(pattern, sizeof(pattern), "\\\"%s\\\"", key); |
| 931 | return strstr(resp, pattern) != NULL; |
| 932 | } |
| 933 | |
| 934 | /* Check response does NOT contain a specific key */ |
| 935 | static int resp_lacks_key(const char *resp, const char *key) { |
no outgoing calls
no test coverage detected