- Timestamp:
- 07/25/2017 12:49:22 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r40843 r41139 325 325 } else { 326 326 $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) ); 327 // nginx only allows HTTP/1.0 methods when redirecting from / to /index.php 328 // To work around this, we manually add index.php to the URL, avoiding the redirect. 329 if ( 'index.php' !== substr( $url, 9 ) ) { 330 $url .= 'index.php'; 331 } 327 332 328 333 $path = '/' . ltrim( $path, '/' ); -
trunk/tests/phpunit/tests/oembed/controller.php
r41047 r41139 417 417 418 418 function test_get_oembed_endpoint_url() { 419 $this->assertEquals( home_url() . '/ ?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url() );420 $this->assertEquals( home_url() . '/ ?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'json' ) );421 $this->assertEquals( home_url() . '/ ?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) );419 $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url() ); 420 $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'json' ) ); 421 $this->assertEquals( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) ); 422 422 423 423 $post_id = $this->factory()->post->create(); … … 425 425 $url_encoded = urlencode( $url ); 426 426 427 $this->assertEquals( home_url() . '/ ?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded, get_oembed_endpoint_url( $url ) );428 $this->assertEquals( home_url() . '/ ?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) );427 $this->assertEquals( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded, get_oembed_endpoint_url( $url ) ); 428 $this->assertEquals( home_url() . '/index.php?rest_route=%2Foembed%2F1.0%2Fembed&url=' . $url_encoded . '&format=xml', get_oembed_endpoint_url( $url, 'xml' ) ); 429 429 } 430 430 -
trunk/tests/phpunit/tests/rest-api.php
r40101 r41139 315 315 // In non-pretty case, we get a query string to invoke the rest router. 316 316 $this->set_permalink_structure( '' ); 317 $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/ ?rest_route=/', get_rest_url() );318 319 } 317 $this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/index.php?rest_route=/', get_rest_url() ); 318 } 319 320 320 /** 321 321 * @ticket 34299 -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r40815 r41139 548 548 array( 549 549 'permalink_structure' => '', 550 'original_url' => 'http://' . WP_TESTS_DOMAIN . '/ ?rest_route=%2Fwp%2Fv2%2Fposts%2F1&foo=bar',550 'original_url' => 'http://' . WP_TESTS_DOMAIN . '/index.php?rest_route=%2Fwp%2Fv2%2Fposts%2F1&foo=bar', 551 551 ), 552 552 ); -
trunk/tests/qunit/fixtures/wp-api-generated.js
r41006 r41139 38 38 ], 39 39 "_links": { 40 "self": "http://example.org/ ?rest_route=/"40 "self": "http://example.org/index.php?rest_route=/" 41 41 } 42 42 }, … … 64 64 ], 65 65 "_links": { 66 "self": "http://example.org/ ?rest_route=/oembed/1.0"66 "self": "http://example.org/index.php?rest_route=/oembed/1.0" 67 67 } 68 68 }, … … 93 93 ], 94 94 "_links": { 95 "self": "http://example.org/ ?rest_route=/oembed/1.0/embed"95 "self": "http://example.org/index.php?rest_route=/oembed/1.0/embed" 96 96 } 97 97 }, … … 143 143 ], 144 144 "_links": { 145 "self": "http://example.org/ ?rest_route=/oembed/1.0/proxy"145 "self": "http://example.org/index.php?rest_route=/oembed/1.0/proxy" 146 146 } 147 147 }, … … 169 169 ], 170 170 "_links": { 171 "self": "http://example.org/ ?rest_route=/wp/v2"171 "self": "http://example.org/index.php?rest_route=/wp/v2" 172 172 } 173 173 }, … … 496 496 ], 497 497 "_links": { 498 "self": "http://example.org/ ?rest_route=/wp/v2/posts"498 "self": "http://example.org/index.php?rest_route=/wp/v2/posts" 499 499 } 500 500 }, … … 1067 1067 ], 1068 1068 "_links": { 1069 "self": "http://example.org/ ?rest_route=/wp/v2/pages"1069 "self": "http://example.org/index.php?rest_route=/wp/v2/pages" 1070 1070 } 1071 1071 }, … … 1605 1605 ], 1606 1606 "_links": { 1607 "self": "http://example.org/ ?rest_route=/wp/v2/media"1607 "self": "http://example.org/index.php?rest_route=/wp/v2/media" 1608 1608 } 1609 1609 }, … … 1789 1789 ], 1790 1790 "_links": { 1791 "self": "http://example.org/ ?rest_route=/wp/v2/types"1791 "self": "http://example.org/index.php?rest_route=/wp/v2/types" 1792 1792 } 1793 1793 }, … … 1849 1849 ], 1850 1850 "_links": { 1851 "self": "http://example.org/ ?rest_route=/wp/v2/statuses"1851 "self": "http://example.org/index.php?rest_route=/wp/v2/statuses" 1852 1852 } 1853 1853 }, … … 1914 1914 ], 1915 1915 "_links": { 1916 "self": "http://example.org/ ?rest_route=/wp/v2/taxonomies"1916 "self": "http://example.org/index.php?rest_route=/wp/v2/taxonomies" 1917 1917 } 1918 1918 }, … … 2091 2091 ], 2092 2092 "_links": { 2093 "self": "http://example.org/ ?rest_route=/wp/v2/categories"2093 "self": "http://example.org/index.php?rest_route=/wp/v2/categories" 2094 2094 } 2095 2095 }, … … 2324 2324 ], 2325 2325 "_links": { 2326 "self": "http://example.org/ ?rest_route=/wp/v2/tags"2326 "self": "http://example.org/index.php?rest_route=/wp/v2/tags" 2327 2327 } 2328 2328 }, … … 2604 2604 ], 2605 2605 "_links": { 2606 "self": "http://example.org/ ?rest_route=/wp/v2/users"2606 "self": "http://example.org/index.php?rest_route=/wp/v2/users" 2607 2607 } 2608 2608 }, … … 2886 2886 ], 2887 2887 "_links": { 2888 "self": "http://example.org/ ?rest_route=/wp/v2/users/me"2888 "self": "http://example.org/index.php?rest_route=/wp/v2/users/me" 2889 2889 } 2890 2890 }, … … 3130 3130 ], 3131 3131 "_links": { 3132 "self": "http://example.org/ ?rest_route=/wp/v2/comments"3132 "self": "http://example.org/index.php?rest_route=/wp/v2/comments" 3133 3133 } 3134 3134 }, … … 3384 3384 ], 3385 3385 "_links": { 3386 "self": "http://example.org/ ?rest_route=/wp/v2/settings"3386 "self": "http://example.org/index.php?rest_route=/wp/v2/settings" 3387 3387 } 3388 3388 } … … 3416 3416 ], 3417 3417 "_links": { 3418 "self": "http://example.org/ ?rest_route=/oembed/1.0"3418 "self": "http://example.org/index.php?rest_route=/oembed/1.0" 3419 3419 } 3420 3420 }, … … 3445 3445 ], 3446 3446 "_links": { 3447 "self": "http://example.org/ ?rest_route=/oembed/1.0/embed"3447 "self": "http://example.org/index.php?rest_route=/oembed/1.0/embed" 3448 3448 } 3449 3449 }, … … 3495 3495 ], 3496 3496 "_links": { 3497 "self": "http://example.org/ ?rest_route=/oembed/1.0/proxy"3497 "self": "http://example.org/index.php?rest_route=/oembed/1.0/proxy" 3498 3498 } 3499 3499 } … … 3574 3574 "collection": [ 3575 3575 { 3576 "href": "http://example.org/ ?rest_route=/wp/v2/posts"3576 "href": "http://example.org/index.php?rest_route=/wp/v2/posts" 3577 3577 } 3578 3578 ], 3579 3579 "about": [ 3580 3580 { 3581 "href": "http://example.org/ ?rest_route=/wp/v2/types/post"3581 "href": "http://example.org/index.php?rest_route=/wp/v2/types/post" 3582 3582 } 3583 3583 ], … … 3755 3755 "collection": [ 3756 3756 { 3757 "href": "http://example.org/ ?rest_route=/wp/v2/pages"3757 "href": "http://example.org/index.php?rest_route=/wp/v2/pages" 3758 3758 } 3759 3759 ], 3760 3760 "about": [ 3761 3761 { 3762 "href": "http://example.org/ ?rest_route=/wp/v2/types/page"3762 "href": "http://example.org/index.php?rest_route=/wp/v2/types/page" 3763 3763 } 3764 3764 ], … … 3921 3921 "collection": [ 3922 3922 { 3923 "href": "http://example.org/ ?rest_route=/wp/v2/media"3923 "href": "http://example.org/index.php?rest_route=/wp/v2/media" 3924 3924 } 3925 3925 ], 3926 3926 "about": [ 3927 3927 { 3928 "href": "http://example.org/ ?rest_route=/wp/v2/types/attachment"3928 "href": "http://example.org/index.php?rest_route=/wp/v2/types/attachment" 3929 3929 } 3930 3930 ], … … 3988 3988 "collection": [ 3989 3989 { 3990 "href": "http://example.org/ ?rest_route=/wp/v2/types"3990 "href": "http://example.org/index.php?rest_route=/wp/v2/types" 3991 3991 } 3992 3992 ], 3993 3993 "wp:items": [ 3994 3994 { 3995 "href": "http://example.org/ ?rest_route=/wp/v2/posts"3995 "href": "http://example.org/index.php?rest_route=/wp/v2/posts" 3996 3996 } 3997 3997 ], … … 4015 4015 "collection": [ 4016 4016 { 4017 "href": "http://example.org/ ?rest_route=/wp/v2/types"4017 "href": "http://example.org/index.php?rest_route=/wp/v2/types" 4018 4018 } 4019 4019 ], 4020 4020 "wp:items": [ 4021 4021 { 4022 "href": "http://example.org/ ?rest_route=/wp/v2/pages"4022 "href": "http://example.org/index.php?rest_route=/wp/v2/pages" 4023 4023 } 4024 4024 ], … … 4042 4042 "collection": [ 4043 4043 { 4044 "href": "http://example.org/ ?rest_route=/wp/v2/types"4044 "href": "http://example.org/index.php?rest_route=/wp/v2/types" 4045 4045 } 4046 4046 ], 4047 4047 "wp:items": [ 4048 4048 { 4049 "href": "http://example.org/ ?rest_route=/wp/v2/media"4049 "href": "http://example.org/index.php?rest_route=/wp/v2/media" 4050 4050 } 4051 4051 ], … … 4082 4082 "archives": [ 4083 4083 { 4084 "href": "http://example.org/ ?rest_route=/wp/v2/posts"4084 "href": "http://example.org/index.php?rest_route=/wp/v2/posts" 4085 4085 } 4086 4086 ] … … 4095 4095 "archives": [ 4096 4096 { 4097 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&status=future"4097 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&status=future" 4098 4098 } 4099 4099 ] … … 4108 4108 "archives": [ 4109 4109 { 4110 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&status=draft"4110 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&status=draft" 4111 4111 } 4112 4112 ] … … 4121 4121 "archives": [ 4122 4122 { 4123 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&status=pending"4123 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&status=pending" 4124 4124 } 4125 4125 ] … … 4134 4134 "archives": [ 4135 4135 { 4136 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&status=private"4136 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&status=private" 4137 4137 } 4138 4138 ] … … 4147 4147 "archives": [ 4148 4148 { 4149 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&status=trash"4149 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&status=trash" 4150 4150 } 4151 4151 ] … … 4174 4174 "collection": [ 4175 4175 { 4176 "href": "http://example.org/ ?rest_route=/wp/v2/taxonomies"4176 "href": "http://example.org/index.php?rest_route=/wp/v2/taxonomies" 4177 4177 } 4178 4178 ], 4179 4179 "wp:items": [ 4180 4180 { 4181 "href": "http://example.org/ ?rest_route=/wp/v2/categories"4181 "href": "http://example.org/index.php?rest_route=/wp/v2/categories" 4182 4182 } 4183 4183 ], … … 4203 4203 "collection": [ 4204 4204 { 4205 "href": "http://example.org/ ?rest_route=/wp/v2/taxonomies"4205 "href": "http://example.org/index.php?rest_route=/wp/v2/taxonomies" 4206 4206 } 4207 4207 ], 4208 4208 "wp:items": [ 4209 4209 { 4210 "href": "http://example.org/ ?rest_route=/wp/v2/tags"4210 "href": "http://example.org/index.php?rest_route=/wp/v2/tags" 4211 4211 } 4212 4212 ], … … 4247 4247 "self": [ 4248 4248 { 4249 "href": "http://example.org/ ?rest_route=/wp/v2/categories/1"4249 "href": "http://example.org/index.php?rest_route=/wp/v2/categories/1" 4250 4250 } 4251 4251 ], 4252 4252 "collection": [ 4253 4253 { 4254 "href": "http://example.org/ ?rest_route=/wp/v2/categories"4254 "href": "http://example.org/index.php?rest_route=/wp/v2/categories" 4255 4255 } 4256 4256 ], 4257 4257 "about": [ 4258 4258 { 4259 "href": "http://example.org/ ?rest_route=/wp/v2/taxonomies/category"4259 "href": "http://example.org/index.php?rest_route=/wp/v2/taxonomies/category" 4260 4260 } 4261 4261 ], 4262 4262 "wp:post_type": [ 4263 4263 { 4264 "href": "http://example.org/ ?rest_route=%2Fwp%2Fv2%2Fposts&categories=1"4264 "href": "http://example.org/index.php?rest_route=%2Fwp%2Fv2%2Fposts&categories=1" 4265 4265 } 4266 4266 ], … … 4306 4306 "collection": [ 4307 4307 { 4308 "href": "http://example.org/ ?rest_route=/wp/v2/tags"4308 "href": "http://example.org/index.php?rest_route=/wp/v2/tags" 4309 4309 } 4310 4310 ], 4311 4311 "about": [ 4312 4312 { 4313 "href": "http://example.org/ ?rest_route=/wp/v2/taxonomies/post_tag"4313 "href": "http://example.org/index.php?rest_route=/wp/v2/taxonomies/post_tag" 4314 4314 } 4315 4315 ], … … 4358 4358 "self": [ 4359 4359 { 4360 "href": "http://example.org/ ?rest_route=/wp/v2/users/1"4360 "href": "http://example.org/index.php?rest_route=/wp/v2/users/1" 4361 4361 } 4362 4362 ], 4363 4363 "collection": [ 4364 4364 { 4365 "href": "http://example.org/ ?rest_route=/wp/v2/users"4365 "href": "http://example.org/index.php?rest_route=/wp/v2/users" 4366 4366 } 4367 4367 ] … … 4389 4389 "collection": [ 4390 4390 { 4391 "href": "http://example.org/ ?rest_route=/wp/v2/users"4391 "href": "http://example.org/index.php?rest_route=/wp/v2/users" 4392 4392 } 4393 4393 ] … … 4456 4456 "collection": [ 4457 4457 { 4458 "href": "http://example.org/ ?rest_route=/wp/v2/comments"4458 "href": "http://example.org/index.php?rest_route=/wp/v2/comments" 4459 4459 } 4460 4460 ],
Note: See TracChangeset
for help on using the changeset viewer.