Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
})

// for eg, to get current user (GET /users/me)
currentUser, resp, body, _ := client.Users().Me()
currentUser, resp, body, _ := client.Users().Me(nil)
if resp.StatusCode != http.StatusOK {
// handle error
}
Expand Down Expand Up @@ -59,9 +59,9 @@ Before running the tests, ensure that you have set up your test environment

### Prerequisites
- Wordpress 4.x
- WP-API plugin
- WP-API's BasicAuth plugin (for authentication)
- [WP REST API Meta Endpoints plugin](https://github.com/WP-API/wp-api-meta-endpoints) (for Meta endpoints)
- [WP-API plugin](https://wordpress.org/plugins/rest-api/)
- [WP-API's BasicAuth plugin](https://github.com/WP-API/Basic-Auth) (for authentication) - I was unable to find this plugin published anywhere outside of github. But it was easy to just choose Clone or Download -> Download ZIP. After that the downloaded ZIP can be treated as a standard plugin and just installed in WordPress via upload.
- [WP REST API Meta Endpoints plugin](https://github.com/WP-API/wp-api-meta-endpoints) (for Meta endpoints) - This can be installed through standard WordPress plugin directory [here](https://wordpress.org/plugins/rest-api-meta-endpoints/)

### Setting up test environment
- Install prequisits (see above)
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (client *Client) PostData(url string, content []byte, contentType string, f
}

req.Header.Set("Content-Type", contentType)
req.Header.Set("Content-Disposition", fmt.Sprintf("filename=%v", filename))
req.Header.Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%v\"", filename))

// Add basic auth
req.SetBasicAuth(s.BasicAuth.Username, s.BasicAuth.Password)
Expand Down
3 changes: 2 additions & 1 deletion posts.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ type Post struct {
Content Content `json:"content,omitempty"`
Author int `json:"author,omitempty"`
Excerpt Excerpt `json:"excerpt,omitempty"`
FeaturedImage int `json:"featured_image,omitempty"`
FeaturedImage int `json:"featured_media,omitempty"`
CommentStatus string `json:"comment_status,omitempty"`
PingStatus string `json:"ping_status,omitempty"`
Format string `json:"format,omitempty"`
Sticky bool `json:"sticky,omitempty"`
Categories []int `json:"categories,omitempty"`
}

func (entity *Post) setCollection(col *PostsCollection) {
Expand Down