| 175 | } |
| 176 | |
| 177 | Feature |
| 178 | QueryValueExtractor::extract(Context &ctx, const Spec &spec) |
| 179 | { |
| 180 | auto qs = this->query_string(ctx); |
| 181 | if (qs.empty()) { |
| 182 | return NIL_FEATURE; |
| 183 | } |
| 184 | auto &&[name, value] = ts::query_value_for(qs, spec._data.text, true); // case insensitive |
| 185 | if (value.size() == 0) { |
| 186 | if (value.data() == nullptr || value.data() == name.end()) { |
| 187 | return NIL_FEATURE; // key not present or value not present |
| 188 | } |
| 189 | return FeatureView::Literal(""); |
| 190 | } |
| 191 | return FeatureView::Direct(value); |
| 192 | } |
| 193 | |
| 194 | // -- |
| 195 |
no test coverage detected