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

Removed additional '?' in WFS request #2048

Merged
merged 5 commits into from
Aug 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions web/client/epics/wfsquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@

const Rx = require('rxjs');
const axios = require('../libs/ajax');
const Url = require('url');
const {changeSpatialAttribute, SELECT_VIEWPORT_SPATIAL_METHOD, updateGeometrySpatialField} = require('../actions/queryform');
const {CHANGE_MAP_VIEW} = require('../actions/map');
const {FEATURE_TYPE_SELECTED, QUERY, featureLoading, featureTypeLoaded, featureTypeError, querySearchResponse, queryError} = require('../actions/wfsquery');
const {paginationInfo} = require('../selectors/query');
const FilterUtils = require('../utils/FilterUtils');
const assign = require('object-assign');
const {isString} = require('lodash');

const {isString, isObject} = require('lodash');
const {setControlProperty} = require('../actions/controls');
// this is a workaround for https://osgeo-org.atlassian.net/browse/GEOS-7233. can be removed when fixed
const workaroundGEOS7233 = ({totalFeatures, features, ...rest}, {startIndex, maxFeatures}, originalSize) => {
if (originalSize > totalFeatures && originalSize === startIndex + features.length && totalFeatures === features.length) {

return {
...rest,
features,
Expand Down Expand Up @@ -140,8 +141,20 @@ const getWFSFilterData = (filterObj) => {

const getWFSFeature = (searchUrl, filterObj) => {
const data = getWFSFilterData(filterObj);

const urlParsedObj = Url.parse(searchUrl, true);
let params = isObject(urlParsedObj.query) ? urlParsedObj.query : {};
params.service = 'WFS';
params.outputFormat = 'json';
const queryString = Url.format({
protocol: urlParsedObj.protocol,
host: urlParsedObj.host,
pathname: urlParsedObj.pathname,
query: params
});

return Rx.Observable.defer( () =>
axios.post(searchUrl + '?service=WFS&outputFormat=json', data, {
axios.post(queryString, data, {
timeout: 60000,
headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}
}));
Expand Down Expand Up @@ -217,7 +230,6 @@ const featureTypeSelectedEpic = action$ =>
const wfsQueryEpic = (action$, store) =>
action$.ofType(QUERY)
.switchMap(action => {

return Rx.Observable.merge(
Rx.Observable.of(setControlProperty('drawer', 'enabled', false)),
getWFSFeature(action.searchUrl, action.filterObj)
Expand Down